> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo/automodel/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo/automodel/_mcp/server.

# nemo_automodel.components.models.glm_moe_dsa.kernels.indexer

## Module Contents

### Classes

| Name                                                                                               | Description |
| -------------------------------------------------------------------------------------------------- | ----------- |
| [`IndexerFunction`](#nemo_automodel-components-models-glm_moe_dsa-kernels-indexer-IndexerFunction) | -           |

### Functions

| Name                                                                                                                       | Description |
| -------------------------------------------------------------------------------------------------------------------------- | ----------- |
| [`generate_varlen_mask_params`](#nemo_automodel-components-models-glm_moe_dsa-kernels-indexer-generate_varlen_mask_params) | -           |
| [`lighting_indexer`](#nemo_automodel-components-models-glm_moe_dsa-kernels-indexer-lighting_indexer)                       | -           |
| [`pytorch_extract_topk_scores`](#nemo_automodel-components-models-glm_moe_dsa-kernels-indexer-pytorch_extract_topk_scores) | -           |

### API

```python
class nemo_automodel.components.models.glm_moe_dsa.kernels.indexer.IndexerFunction()
```

**Bases:** `Function`

```python
nemo_automodel.components.models.glm_moe_dsa.kernels.indexer.IndexerFunction.backward(
    ctx,
    grad_scores,
    grad_indices
)
```

staticmethod

```python
nemo_automodel.components.models.glm_moe_dsa.kernels.indexer.IndexerFunction.forward(
    ctx,
    index_q: torch.Tensor,
    index_k: torch.Tensor,
    weights: torch.Tensor,
    cu_seqlen_ks: torch.Tensor,
    cu_seqlen_ke: torch.Tensor,
    topk: int,
    topk_indices: torch.Tensor | None = None
)
```

staticmethod

```python
nemo_automodel.components.models.glm_moe_dsa.kernels.indexer.generate_varlen_mask_params(
    cu_seqlens
)
```

```python
nemo_automodel.components.models.glm_moe_dsa.kernels.indexer.lighting_indexer(
    index_q: torch.Tensor,
    index_k: torch.Tensor,
    weights: torch.Tensor,
    cu_seqlen_ks: torch.Tensor,
    cu_seqlen_ke: torch.Tensor,
    topk: int,
    topk_indices: torch.Tensor | None = None
)
```

```python
nemo_automodel.components.models.glm_moe_dsa.kernels.indexer.pytorch_extract_topk_scores(
    logits,
    topk_indices,
    dim = -1
)
```