> This page is for version Nightly (default).
> 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.optim.nvfp4_adam_cuda

Source text of the Adam step of NVFP4 expert weights (CUDA) and its torch binding.

`nvfp4_resident_adam` hands these strings to `torch.utils.cpp_extension.load_inline` as
`cpp_sources = [HEADER, BINDING]` and `cuda_sources = [HEADER, KERNEL]`, so the wheel ships Python files only.
The header is inlined into both translation units (there is no file to `#include`), which is why it carries no
`#pragma once`.

Both kernels return the bits of the Transformer Engine kernel they stand in for. The Adam arithmetic is written as
explicit PTX operations for that reason: Transformer Engine builds its Adam kernel with `--use_fast_math`, and
the result depends on which operations the compiler then emits.

## Module Contents

### Data

[`BINDING`](#nemo_automodel-components-optim-nvfp4_adam_cuda-BINDING)

[`HEADER`](#nemo_automodel-components-optim-nvfp4_adam_cuda-HEADER)

[`KERNEL`](#nemo_automodel-components-optim-nvfp4_adam_cuda-KERNEL)

[`_LICENSE`](#nemo_automodel-components-optim-nvfp4_adam_cuda-_LICENSE)

### API

```python
nemo_automodel.components.optim.nvfp4_adam_cuda.BINDING = _LICENSE + '\n#include <torch/extension.h>\n#include <ATen/cuda/CUDAContext.h>\n...
```

```python
nemo_automodel.components.optim.nvfp4_adam_cuda.HEADER = _LICENSE + '\n#include <cstdint>\n#include <cuda_runtime.h>\n\n// Tensors of one...
```

```python
nemo_automodel.components.optim.nvfp4_adam_cuda.KERNEL = _LICENSE + '\n// Adam on FP32 master weights with FP32 moments and BF16 gradient...
```

```python
nemo_automodel.components.optim.nvfp4_adam_cuda._LICENSE = '// Copyright (c) 2026, NVIDIA CORPORATION. All rights reserved.\n// Licensed un...
```