> 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.glm4_moe.layers

## Module Contents

### Classes

| Name                                                                                     | Description                                                                 |
| ---------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- |
| [`Glm4MoeAttention`](#nemo_automodel-components-models-glm4_moe-layers-Glm4MoeAttention) | GLM4 MoE attention with optional query/key per-head RMSNorm + partial RoPE. |

### API

```python
class nemo_automodel.components.models.glm4_moe.layers.Glm4MoeAttention(
    config: transformers.models.glm4_moe.configuration_glm4_moe.Glm4MoeConfig,
    backend: nemo_automodel.components.models.common.BackendConfig
)
```

**Bases:** `Module`

GLM4 MoE attention with optional query/key per-head RMSNorm + partial RoPE.

```python
nemo_automodel.components.models.glm4_moe.layers.Glm4MoeAttention.forward(
    x: torch.Tensor,
    freqs_cis: torch.Tensor,
    attention_mask: torch.Tensor | None = None,
    attn_kwargs: typing.Any = {}
) -> torch.Tensor
```

```python
nemo_automodel.components.models.glm4_moe.layers.Glm4MoeAttention.init_weights(
    buffer_device: torch.device,
    init_std: float = 0.02
)
```