> 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

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

[`_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.__all__ = ['patch']
```

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