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

## Module Contents

### Functions

| Name                                                                | Description                                                               |
| ------------------------------------------------------------------- | ------------------------------------------------------------------------- |
| [`_add_nvtx_hooks`](#nemo_automodel-autonvtx-_add_nvtx_hooks)       | Add NVTX range hooks to a model's forward and optionally backward passes. |
| [`_get_active_ranges`](#nemo_automodel-autonvtx-_get_active_ranges) | Get the set of currently active NVTX ranges for this thread.              |
| [`patch`](#nemo_automodel-autonvtx-patch)                           | Recursively patch a model with NVTX profiling annotations.                |

### Data

[`_thread_local`](#nemo_automodel-autonvtx-_thread_local)

### API

```python
nemo_automodel.autonvtx._add_nvtx_hooks(
    model,
    name,
    add_backward_hooks = True
)
```

Add NVTX range hooks to a model's forward and optionally backward passes.

```python
nemo_automodel.autonvtx._get_active_ranges()
```

Get the set of currently active NVTX ranges for this thread.

```python
nemo_automodel.autonvtx.patch(
    model,
    name = None,
    add_backward_hooks = True
)
```

Recursively patch a model with NVTX profiling annotations.

Prevents duplicate scopes when activation checkpointing reruns forward passes.

```python
nemo_automodel.autonvtx._thread_local = local()
```