> This page is for version 0.5.0 · 26.06.
> For other versions, use one of these documentation indexes:
> - Nightly (default): https://docs.nvidia.com/nemo/automodel/nightly/llms.txt
> - Latest: https://docs.nvidia.com/nemo/automodel/latest/llms.txt
> - 0.7.0 · 26.10: https://docs.nvidia.com/nemo/automodel/v0.7/llms.txt
> - 0.5.0 · 26.06: https://docs.nvidia.com/nemo/automodel/v0.5/llms.txt
> - 0.4.0 · 26.04: https://docs.nvidia.com/nemo/automodel/v0.4/llms.txt

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

# nemo_automodel.components.models.ergo.rope

Source-equivalent CPU RoPE tables with a model-owned device cache.

The arithmetic contract is documented in layers.py's release provenance.
DeepSeek's shared helpers allow default-device construction and fused rotation;
Ergo requires CPU FP32 table construction and its existing complex rotation.

## Module Contents

### Classes

| Name                                                                                         | Description                                                                |
| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
| [`ErgoRotaryFrequencies`](#nemo_automodel-components-models-ergo-rope-ErgoRotaryFrequencies) | Share one derived table across attention layers, outside checkpoint state. |

### API

```python
class nemo_automodel.components.models.ergo.rope.ErgoRotaryFrequencies(
    config: nemo_automodel.components.models.ergo.config.ErgoConfig
)
```

**Bases:** `Module`

Share one derived table across attention layers, outside checkpoint state.

These caches deliberately are not buffers: Module.to(dtype) would cast complex
buffers to real values, and to_empty would destroy their contents. The CPU
master remains complex64; module transforms invalidate only the device copy.
Construction is lazy so meta initialization allocates no frequency table.

**`_cpu_frequencies`** `Tensor | None = None`

---

**`_device_frequencies`** `Tensor | None = None`

---

**`head_dim`** `= config.head_dim`

---

**`max_positions`** `= config.max_position_embeddings`

---

**`theta`** `= config.rope_theta`

---

```python
nemo_automodel.components.models.ergo.rope.ErgoRotaryFrequencies._apply(
    fn: collections.abc.Callable[[torch.Tensor], torch.Tensor],
    recurse: bool = True
) -> typing.Self
```

```python
nemo_automodel.components.models.ergo.rope.ErgoRotaryFrequencies.forward(
    positions: torch.Tensor
) -> torch.Tensor
```

Select CPU-rounded complex64 frequencies on the positions' device.

**Parameters:**

**`positions`** `torch.Tensor`

Integer IDs \[batch, sequence] or packed \[tokens], in
\[0, max_position_embeddings). Resets and repeated IDs are valid.

---

**Returns:** `torch.Tensor`

Complex64 frequencies \[batch, sequence, head_dim / 2] or