> This page is for version 0.4.0 · 26.04.
> 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.
> 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.training.batch

Move model input tensors while retaining host-side packing metadata.

## Module Contents

### Functions

| Name                                                                                     | Description                                                                |
| ---------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
| [`move_batch_to_device`](#nemo_automodel-components-training-batch-move_batch_to_device) | Transfer training/validation inputs without moving deferred attention IDs. |

### API

```python
nemo_automodel.components.training.batch.move_batch_to_device(
    batch: collections.abc.Mapping[str, typing.Any],
    device: torch.device
) -> dict[str, typing.Any]
```

Transfer training/validation inputs without moving deferred attention IDs.

**Parameters:**

**`batch`** `Mapping[str, Any]`

Model inputs containing tensors of arbitrary shape, including
nested mappings/lists/tuples. `_packed_seq_ids` is an integer
tensor \[batch, sequence] retained on CPU only when masks/Flash metadata still need preparation.
THD and prepared-mask inputs transfer normally.

---

**`device`** `torch.device`

Destination for all other tensor inputs.

---

**Returns:** `dict[str, Any]`

New containers preserving tensor shapes and dtypes. Deferred attention