[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-nvidia-dali-dynamic-mode":3,"mdc--d84zx0-key":28,"related-org-nvidia-dali-dynamic-mode":2987,"related-repo-nvidia-dali-dynamic-mode":3147},{"slug":4,"name":4,"fn":5,"description":6,"org":7,"tags":11,"stars":17,"repoUrl":18,"updatedAt":19,"license":20,"forks":21,"topics":22,"repo":23,"sourceUrl":26,"mdContent":27},"dali-dynamic-mode","develop DALI pipelines with dynamic mode","DALI imperative dynamic mode (`nvidia.dali.experimental.dynamic`, ndd): use when working on ndd code or migrating pipelines; skip pipeline-only tasks.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},"nvidia","NVIDIA","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Fnvidia.png",[12,16],{"name":13,"slug":14,"type":15},"Data Pipeline","data-pipeline","tag",{"name":9,"slug":8,"type":15},2473,"https:\u002F\u002Fgithub.com\u002FNVIDIA\u002Fskills","2026-07-14T05:26:18.919555","Apache-2.0",281,[],{"repoUrl":18,"stars":17,"forks":21,"topics":24,"description":25},[],"AI agent skills published by NVIDIA","https:\u002F\u002Fgithub.com\u002FNVIDIA\u002Fskills\u002Ftree\u002FHEAD\u002Fskills\u002Fdali-dynamic-mode","---\nname: dali-dynamic-mode\ndescription: \"DALI imperative dynamic mode (`nvidia.dali.experimental.dynamic`, ndd): use when working on ndd code or migrating pipelines; skip pipeline-only tasks.\"\nlicense: Apache-2.0\nmetadata:\n  author: \"DALI Team \u003Cdali-team@nvidia.com>\"\n  tags:\n    - dali\n    - dynamic-mode\n    - ndd\n    - data-loading\n    - data-processing\n    - gpu-processing\n  languages:\n    - python\n  team: dali\n  domain: deep-learning\n---\n\n# DALI Dynamic Mode\n\n## Purpose\n\nGuide AI agents in writing, reviewing, and migrating code that uses DALI's imperative dynamic-mode API, `nvidia.dali.experimental.dynamic` (`ndd`).\n\n## Instructions\n\n- Import dynamic mode as `nvidia.dali.experimental.dynamic as ndd` and write code as direct `ndd` calls in ordinary Python; do not use pipeline-mode APIs such as `Pipeline`, `@pipeline_def`, `pipe.build()`, or `pipe.run()`.\n- Treat readers as stateful: create them once, reuse them across epochs, and pass `batch_size` to `next_epoch(...)`.\n- Pass explicit `batch_size` to random ops; there is no pipeline-level batch size to inherit.\n- Use dynamic-mode API conventions: `device=\"gpu\"` instead of pipeline-mode `\"mixed\"`, `Batch.tensors[...]` for sample selection, and `Batch.slice[...]` for per-sample slicing.\n- Use `.torch()` to convert a tensor or batch to a PyTorch tensor. Use `pad=True` for batches with variable shapes.\n\n## Prerequisites\n\n- To run or validate code, NVIDIA DALI must be installed with dynamic mode importable as `nvidia.dali.experimental.dynamic`.\n- GPU decode or GPU operators require a CUDA-capable DALI build and an available NVIDIA GPU\u002Fdriver.\n- Framework conversion examples require the target framework installed, such as PyTorch for `.torch()`.\n\n## Introduction\n\nDynamic mode is DALI's imperative Python API. It lets code call DALI operators directly from normal Python control flow instead of building and running a pipeline graph.\n\n## Core Data Types\n\n### Tensor -- single sample\n\n```python\nt = ndd.tensor(data)           # copy\nt = ndd.as_tensor(data)        # wrap, no copy if possible\nt.cpu()                        # move to CPU\nt.gpu()                        # move to GPU\nt.torch(copy=False)            # conversion to PyTorch tensor with no copy (default)\nt[1:3]                         # slicing supported\nnp.asarray(t)                  # NumPy via __array__ (CPU only)\n```\n\nSupports `__dlpack__`, `__cuda_array_interface__`, `__array__`, arithmetic operators.\n\n### Batch -- collection of samples (variable shapes OK)\n\n```python\nb = ndd.batch([arr1, arr2])    # copy\nb = ndd.as_batch(data)         # wrap, no copy if possible\n```\n\n**Batch has no `__getitem__`** -- `batch[i]` raises `TypeError` because indexing is ambiguous (sample selection vs. per-sample slicing). Use the explicit APIs instead:\n\n| Intent | Method | Returns |\n|--------|--------|---------|\n| Get sample i | `batch.tensors[i]` | `Tensor` |\n| Get subset of samples | `batch.tensors[slice_or_list]` | `Batch` |\n| Slice within each sample | `batch.slice[...]` | `Batch` (same batch_size) |\n| Sample-wise slicing | `batch.slice[batch_of_indices]` | `Batch` (same batch_size) |\n\n`.tensors[]` picks **which samples**. `.slice` indexes **inside each sample**.\n\n```python\nxy = ndd.random.uniform(batch_size=16, range=[0, 1], shape=2)\ncrop_x = xy.slice[0]       # Batch of 16 scalars, first element from each sample\ncrop_y = xy.slice[1]       # Batch of 16 scalars, second element from each sample\nsample_0 = xy.tensors[0]   # Tensor, the entire first sample [x, y]\n```\n\n### Advanced slicing\n\nThe `.slice[]` API accepts batches of indices, allowing the user to mix and match batches and\nscalar values, e.g.:\n```python\nimgs = ndd.imread(filenames)  # a batch of images, if `filenames` is a list\nsliced = imgs.slice[\n    42 :  # the range start is broadcast to all samples\n    ndd.batch(imgs.shape).slice[0] \u002F\u002F 2  # per-sample range stop (half of each image)\n]\n```\n\n**PyTorch conversion:**\n- `batch.torch()` -- works for uniform shapes; raises for ragged batches\n- `batch.torch(pad=True)` -- zero-pads ragged batches to max shape (use for variable-length audio, detection boxes, etc.)\n- `batch.torch(copy=None)` is the default (avoids copy if possible)\n- Batch has **no `__dlpack__`** -- use `ndd.as_tensor(batch)` first for DLPack consumers. `ndd.as_tensor` supports `pad` as well.\n- `Tensor.torch(copy=False)` is default (no copy)\n\n**Iteration:** `for sample in batch:` yields Tensors.\n\n## Readers\n\nReaders are **stateful objects** -- create once, reuse across epochs. This matters because readers track internal state like shuffle order and shard position.\n\n```python\nreader = ndd.readers.File(file_root=image_dir, random_shuffle=True)\n\nfor epoch in range(num_epochs):\n    for jpegs, labels in reader.next_epoch(batch_size=64):\n        # jpegs, labels are Batch objects\n        ...\n```\n\nKey points:\n- Reader outputs (jpegs, labels, etc.) are **CPU** tensors\u002Fbatches. Labels typically stay on CPU until you convert them for your framework (e.g. `labels.torch().to(device)`).\n- Reader classes are **PascalCase**: `ndd.readers.File(...)`, `ndd.readers.COCO(...)`, `ndd.readers.TFRecord(...)`\n- `batch_size` goes to `next_epoch()`, not to the reader constructor\n- `next_epoch(batch_size=N)` yields tuples of `Batch`; `next_epoch()` without batch_size yields tuples of `Tensor`\n- The iterator from `next_epoch()` must be fully consumed before calling `next_epoch()` again\n- Once a reader is used with a given batch_size, it cannot be changed. Similarly, a reader used in batch mode cannot switch to sample mode or vice versa.\n\nSharded reading for distributed training:\n```python\nreader = ndd.readers.File(\n    file_root=image_dir,\n    shard_id=rank, num_shards=world_size,\n    stick_to_shard=True,\n    pad_last_batch=True,\n)\n```\n\n## Device Handling\n\n- Device is **inferred from inputs** -- GPU if any input is on GPU\n- For hybrid decode: use `device=\"gpu\"` (NOT `\"mixed\"`). The `\"mixed\"` keyword is a pipeline-mode concept for implicit CPU-to-GPU transfer; in dynamic mode, passing `device=\"gpu\"` triggers the same hardware-accelerated decode path.\n- Don't call `.cpu()` before passing to a GPU model -- `.torch()` gives you a GPU tensor directly. `.cpu()` is only needed for consumers requiring host memory (numpy, `__array__`).\n- CUDA stream sync between DALI and PyTorch is **automatic via DLPack** -- no manual stream management needed.\n\n## Execution Model\n\nDefault mode is `eager` -- async execution in a background thread, returns immediately.\n\n**No `.evaluate()` needed in most cases.** Any data consumption (`.torch()`, `__dlpack__`, `__array__`, `.shape`, property access, iteration) triggers evaluation automatically.\n\nFor debugging, switch to synchronous mode so errors surface at the exact call site rather than later in the async queue:\n\n```python\nwith ndd.EvalMode.sync_cpu:\n    images = ndd.decoders.image(jpegs, device=\"gpu\")\n    images = ndd.resize(images, size=[224, 224])\n    # Any error surfaces here, at the exact op that failed\n```\n\nModes (increasing synchronicity): `deferred` \u003C `eager` \u003C `sync_cpu` \u003C `sync_full`\n\nUse `EvalMode.sync_full` for debugging instead of scattering `.evaluate()` calls -- it's cleaner and catches all issues at once. `sync_cpu` is often sufficient and lighter than `sync_full`.\n\n## Thread Configuration\n\n```python\nndd.set_num_threads(4)  # Call once at startup, only if necessary to override the defaults\n```\n\nControls DALI's internal worker threads for CPU operators. Defaults to CPU affinity count or `DALI_NUM_THREADS` env var. Unrelated to Python-level threading.\n\n## RNG\n\nTwo approaches (use one, not both):\n\n```python\n# Approach 1: set the thread-local default seed (simple, good enough for most cases)\nndd.random.set_seed(42)\nangles = ndd.random.uniform(batch_size=64, range=(-30, 30))\n\n# Approach 2: explicit RNG object (finer control, pass rng= to each op)\nrng = ndd.random.RNG(seed=42)\nvalues = ndd.random.uniform(batch_size=64, range=[0, 1], shape=2, rng=rng)\n```\n\nWhen `rng=` is passed to a random op, the explicit RNG overrides the default seed. Thread-local: each thread has independent random state.\n\nRandom ops need an explicit `batch_size` when working with batches -- there is no pipeline-level batch size to inherit.\n\n## Checkpointing\n\nDynamic mode has **no pipeline-level checkpoint**. Checkpoints aggregate the state of individual stateful objects: readers and `RNG` instances. Stateless ops (decoders, resize, rotate, normalize, ...) are not part of a checkpoint.\n\n```python\nckpt = ndd.checkpoint.Checkpoint()\nckpt.register(reader, \"my_reader\")\nckpt.register(rng, \"rng\")\n\n# ... iterate for a while ...\n\nckpt.collect()                       # snapshot the registered objects\nckpt.save(\"ckpt_{seq:04d}.json\")     # writes ckpt_0000.json, ckpt_0001.json, ...\n```\n\nRestoring is the symmetric operation -- build a *fresh* reader and `RNG`, then `load` + `register`. The loaded state is applied to each object at `register` time:\n\n```python\nreader = ndd.readers.File(file_root=..., enable_checkpointing=True, name=\"my_reader\")\nrng = ndd.random.RNG()\n\nckpt = ndd.checkpoint.Checkpoint()\nckpt.load(\"ckpt_{seq:04d}.json\")     # picks the highest sequence number\nckpt.register(reader, \"my_reader\")   # state applied here\nckpt.register(rng, \"rng\")            # ditto\n\nfor batch in reader.next_epoch(batch_size=N):\n    ...  # produces the next batch after the checkpointed iteration\n```\n\nKey rules:\n\n- **Readers must opt in.** Construct with `enable_checkpointing=True`. Registering an already-iterated reader without it raises `RuntimeError`; if the reader has not been iterated yet, `register` enables it retroactively.\n- **Reader state must be applied before the first `next_epoch` call.** The prefetch thread starts on first iteration and the snapshot queue is locked after that. `set_state` (or a `register` from a loaded checkpoint) on an already-iterated reader raises `RuntimeError`.\n- **`enable_checkpointing=True` is incompatible with `compile=True`.** Calling `reader.next_epoch(..., compile=True)` on a checkpointing-enabled reader raises `NotImplementedError`.\n- **Named registration is safer.** Anonymous `register(op)` uses sequential keys (`__op_0`, `__op_1`, ...) so the registration order must match between save and restore. Type tags catch cross-type swaps but not reorders of compatible types. Prefer `register(op, name)`.\n- **`ndd.checkpoint.current()`** returns the `Checkpoint` bound to the current thread-local `EvalContext`. It's shared across calls -- call `ckpt.clear()` if reusing the default context for unrelated runs.\n- **Filename pattern:** `save`\u002F`load` take a Python format string with a single `{seq}` placeholder (e.g. `\"ckpt_{seq:04d}.json\"`). `save` picks the next free sequence; `load` picks the highest matching one on disk.\n- **Format version is strict.** `deserialize` rejects payloads from a different checkpoint format version -- no automatic upgrade.\n- **Not thread-safe.** One `Checkpoint` per thread.\n\nManual `get_state` \u002F `set_state` is also available directly on each `Reader` and `RNG` -- the `Checkpoint` aggregator is built on top of it. Use the manual API only when integrating with an external checkpoint system.\n\n## Examples\n\n### Image Classification Pipeline\n\n```python\nimport nvidia.dali.experimental.dynamic as ndd\n\nreader = ndd.readers.File(file_root=\"\u002Fdata\u002Fimagenet\u002Ftrain\", random_shuffle=True)\n\nfor epoch in range(num_epochs):\n    for jpegs, labels in reader.next_epoch(batch_size=64):\n        images = ndd.decoders.image(jpegs, device=\"gpu\")\n        images = ndd.resize(images, size=[224, 224])\n        images = ndd.crop_mirror_normalize(\n            images,\n            mean=[0.485 * 255, 0.456 * 255, 0.406 * 255],\n            std=[0.229 * 255, 0.224 * 255, 0.225 * 255],\n        )\n        train_step(images.torch(), labels.torch())\n```\n\n## Common Mistakes\n\n| Wrong | Right | Why |\n|-------|-------|-----|\n| `device=\"mixed\"` | `device=\"gpu\"` | `\"mixed\"` is pipeline mode only |\n| `batch[i]` | `batch.tensors[i]` | `Batch` has no `__getitem__` |\n| `batch.tensors[0]` for per-sample slicing | `batch.slice[0]` | `.tensors` pick samples; `.slice` slices within each sample |\n| `.evaluate()` after every op | Let consumption trigger eval | `.torch()`, `.shape`, etc. trigger it automatically |\n| `.cpu()` before GPU model | `.torch()` directly | Avoids wasteful D2H + H2D round-trip |\n| Recreate reader each epoch | `reader.next_epoch()` | Readers are stateful -- create once, reuse |\n| `ndd.readers.file(...)` | `ndd.readers.File(...)` | Reader classes are PascalCase |\n| `break` from `next_epoch()` loop | Exhaust iterator or create new reader | Iterator must be fully consumed before next `next_epoch()` |\n| No `batch_size` to random ops | `ndd.random.uniform(batch_size=N, ...)` | No pipeline-level batch size to inherit |\n| `register(reader)` after first `next_epoch` to restore | Register the freshly built reader before the first iteration | Reader state can only be applied before the prefetch thread starts |\n| Restoring into a reader built without `enable_checkpointing=True` after iteration | Pass `enable_checkpointing=True` at construction (or register before first iteration) | Backend doesn't keep snapshots otherwise |\n| Spelling out default argument values | Skip default argument values | Very high Python-side overhead, especially when the argument accepts Tensors\u002FBatches. Skipping arguments uses a fast path, actually passing a sentinel value. |\n\n## Pipeline Mode Migration\n\n| Pipeline Mode | Dynamic Mode |\n|--------------|--------------|\n| `@pipeline_def` \u002F `pipe.build()` \u002F `pipe.run()` | Direct function calls in a loop |\n| `fn.readers.file(...)` | `ndd.readers.File(...)` (PascalCase, stateful) |\n| `fn.decoders.image(jpegs, device=\"mixed\")` | `ndd.decoders.image(jpegs, device=\"gpu\")` |\n| `fn.op_name(...)` | `ndd.op_name(...)` |\n| Pipeline-level `batch_size=64` | `reader.next_epoch(batch_size=64)` + random ops `batch_size=64` |\n| Pipeline-level `seed=42` | `ndd.random.set_seed(42)` or `ndd.random.RNG(seed=42)` |\n| Pipeline-level `num_threads=4` | `ndd.set_num_threads(4)` at startup |\n| `output.at(i)` | `batch.tensors[i]` |\n| `output.as_cpu()` | `batch.cpu()` |\n| `pipe.run()` returns tuple of `TensorList` | `reader.next_epoch(batch_size=N)` yields tuples of `Batch` |\n| `Pipeline(..., enable_checkpointing=True)` + `pipe.checkpoint()` \u002F `pipeline(checkpoint=...)` | `ndd.checkpoint.Checkpoint` + per-object `register` \u002F `collect` \u002F `save` \u002F `load`; readers opt in with `enable_checkpointing=True` |\n\n## Limitations\n\nDynamic mode is more flexible than pipeline mode, but can have slightly worse performance. For maximum throughput, prefer pipeline mode.\n\n## Troubleshooting\n\n- If errors surface later than the failing call, rerun the block under `EvalMode.sync_cpu` or `EvalMode.sync_full`.\n- If a reader behaves unexpectedly across epochs, check that it is created once and each `next_epoch()` iterator is fully consumed.\n",{"data":29,"body":42},{"name":4,"description":6,"license":20,"metadata":30},{"author":31,"tags":32,"languages":39,"team":33,"domain":41},"DALI Team \u003Cdali-team@nvidia.com>",[33,34,35,36,37,38],"dali","dynamic-mode","ndd","data-loading","data-processing","gpu-processing",[40],"python","deep-learning",{"type":43,"children":44},"root",[45,53,60,82,88,233,239,269,275,280,286,293,368,395,401,424,457,595,627,666,672,685,732,740,828,846,852,864,920,925,1051,1056,1111,1117,1210,1216,1229,1273,1278,1317,1349,1381,1387,1401,1414,1420,1425,1487,1500,1512,1518,1537,1607,1650,1736,1741,2019,2061,2067,2073,2192,2198,2584,2590,2931,2937,2942,2948,2981],{"type":46,"tag":47,"props":48,"children":49},"element","h1",{"id":4},[50],{"type":51,"value":52},"text","DALI Dynamic Mode",{"type":46,"tag":54,"props":55,"children":57},"h2",{"id":56},"purpose",[58],{"type":51,"value":59},"Purpose",{"type":46,"tag":61,"props":62,"children":63},"p",{},[64,66,73,75,80],{"type":51,"value":65},"Guide AI agents in writing, reviewing, and migrating code that uses DALI's imperative dynamic-mode API, ",{"type":46,"tag":67,"props":68,"children":70},"code",{"className":69},[],[71],{"type":51,"value":72},"nvidia.dali.experimental.dynamic",{"type":51,"value":74}," (",{"type":46,"tag":67,"props":76,"children":78},{"className":77},[],[79],{"type":51,"value":35},{"type":51,"value":81},").",{"type":46,"tag":54,"props":83,"children":85},{"id":84},"instructions",[86],{"type":51,"value":87},"Instructions",{"type":46,"tag":89,"props":90,"children":91},"ul",{},[92,144,164,176,212],{"type":46,"tag":93,"props":94,"children":95},"li",{},[96,98,104,106,111,113,119,121,127,128,134,136,142],{"type":51,"value":97},"Import dynamic mode as ",{"type":46,"tag":67,"props":99,"children":101},{"className":100},[],[102],{"type":51,"value":103},"nvidia.dali.experimental.dynamic as ndd",{"type":51,"value":105}," and write code as direct ",{"type":46,"tag":67,"props":107,"children":109},{"className":108},[],[110],{"type":51,"value":35},{"type":51,"value":112}," calls in ordinary Python; do not use pipeline-mode APIs such as ",{"type":46,"tag":67,"props":114,"children":116},{"className":115},[],[117],{"type":51,"value":118},"Pipeline",{"type":51,"value":120},", ",{"type":46,"tag":67,"props":122,"children":124},{"className":123},[],[125],{"type":51,"value":126},"@pipeline_def",{"type":51,"value":120},{"type":46,"tag":67,"props":129,"children":131},{"className":130},[],[132],{"type":51,"value":133},"pipe.build()",{"type":51,"value":135},", or ",{"type":46,"tag":67,"props":137,"children":139},{"className":138},[],[140],{"type":51,"value":141},"pipe.run()",{"type":51,"value":143},".",{"type":46,"tag":93,"props":145,"children":146},{},[147,149,155,157,163],{"type":51,"value":148},"Treat readers as stateful: create them once, reuse them across epochs, and pass ",{"type":46,"tag":67,"props":150,"children":152},{"className":151},[],[153],{"type":51,"value":154},"batch_size",{"type":51,"value":156}," to ",{"type":46,"tag":67,"props":158,"children":160},{"className":159},[],[161],{"type":51,"value":162},"next_epoch(...)",{"type":51,"value":143},{"type":46,"tag":93,"props":165,"children":166},{},[167,169,174],{"type":51,"value":168},"Pass explicit ",{"type":46,"tag":67,"props":170,"children":172},{"className":171},[],[173],{"type":51,"value":154},{"type":51,"value":175}," to random ops; there is no pipeline-level batch size to inherit.",{"type":46,"tag":93,"props":177,"children":178},{},[179,181,187,189,195,196,202,204,210],{"type":51,"value":180},"Use dynamic-mode API conventions: ",{"type":46,"tag":67,"props":182,"children":184},{"className":183},[],[185],{"type":51,"value":186},"device=\"gpu\"",{"type":51,"value":188}," instead of pipeline-mode ",{"type":46,"tag":67,"props":190,"children":192},{"className":191},[],[193],{"type":51,"value":194},"\"mixed\"",{"type":51,"value":120},{"type":46,"tag":67,"props":197,"children":199},{"className":198},[],[200],{"type":51,"value":201},"Batch.tensors[...]",{"type":51,"value":203}," for sample selection, and ",{"type":46,"tag":67,"props":205,"children":207},{"className":206},[],[208],{"type":51,"value":209},"Batch.slice[...]",{"type":51,"value":211}," for per-sample slicing.",{"type":46,"tag":93,"props":213,"children":214},{},[215,217,223,225,231],{"type":51,"value":216},"Use ",{"type":46,"tag":67,"props":218,"children":220},{"className":219},[],[221],{"type":51,"value":222},".torch()",{"type":51,"value":224}," to convert a tensor or batch to a PyTorch tensor. Use ",{"type":46,"tag":67,"props":226,"children":228},{"className":227},[],[229],{"type":51,"value":230},"pad=True",{"type":51,"value":232}," for batches with variable shapes.",{"type":46,"tag":54,"props":234,"children":236},{"id":235},"prerequisites",[237],{"type":51,"value":238},"Prerequisites",{"type":46,"tag":89,"props":240,"children":241},{},[242,253,258],{"type":46,"tag":93,"props":243,"children":244},{},[245,247,252],{"type":51,"value":246},"To run or validate code, NVIDIA DALI must be installed with dynamic mode importable as ",{"type":46,"tag":67,"props":248,"children":250},{"className":249},[],[251],{"type":51,"value":72},{"type":51,"value":143},{"type":46,"tag":93,"props":254,"children":255},{},[256],{"type":51,"value":257},"GPU decode or GPU operators require a CUDA-capable DALI build and an available NVIDIA GPU\u002Fdriver.",{"type":46,"tag":93,"props":259,"children":260},{},[261,263,268],{"type":51,"value":262},"Framework conversion examples require the target framework installed, such as PyTorch for ",{"type":46,"tag":67,"props":264,"children":266},{"className":265},[],[267],{"type":51,"value":222},{"type":51,"value":143},{"type":46,"tag":54,"props":270,"children":272},{"id":271},"introduction",[273],{"type":51,"value":274},"Introduction",{"type":46,"tag":61,"props":276,"children":277},{},[278],{"type":51,"value":279},"Dynamic mode is DALI's imperative Python API. It lets code call DALI operators directly from normal Python control flow instead of building and running a pipeline graph.",{"type":46,"tag":54,"props":281,"children":283},{"id":282},"core-data-types",[284],{"type":51,"value":285},"Core Data Types",{"type":46,"tag":287,"props":288,"children":290},"h3",{"id":289},"tensor-single-sample",[291],{"type":51,"value":292},"Tensor -- single sample",{"type":46,"tag":294,"props":295,"children":299},"pre",{"className":296,"code":297,"language":40,"meta":298,"style":298},"language-python shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","t = ndd.tensor(data)           # copy\nt = ndd.as_tensor(data)        # wrap, no copy if possible\nt.cpu()                        # move to CPU\nt.gpu()                        # move to GPU\nt.torch(copy=False)            # conversion to PyTorch tensor with no copy (default)\nt[1:3]                         # slicing supported\nnp.asarray(t)                  # NumPy via __array__ (CPU only)\n","",[300],{"type":46,"tag":67,"props":301,"children":302},{"__ignoreMap":298},[303,314,323,332,341,350,359],{"type":46,"tag":304,"props":305,"children":308},"span",{"class":306,"line":307},"line",1,[309],{"type":46,"tag":304,"props":310,"children":311},{},[312],{"type":51,"value":313},"t = ndd.tensor(data)           # copy\n",{"type":46,"tag":304,"props":315,"children":317},{"class":306,"line":316},2,[318],{"type":46,"tag":304,"props":319,"children":320},{},[321],{"type":51,"value":322},"t = ndd.as_tensor(data)        # wrap, no copy if possible\n",{"type":46,"tag":304,"props":324,"children":326},{"class":306,"line":325},3,[327],{"type":46,"tag":304,"props":328,"children":329},{},[330],{"type":51,"value":331},"t.cpu()                        # move to CPU\n",{"type":46,"tag":304,"props":333,"children":335},{"class":306,"line":334},4,[336],{"type":46,"tag":304,"props":337,"children":338},{},[339],{"type":51,"value":340},"t.gpu()                        # move to GPU\n",{"type":46,"tag":304,"props":342,"children":344},{"class":306,"line":343},5,[345],{"type":46,"tag":304,"props":346,"children":347},{},[348],{"type":51,"value":349},"t.torch(copy=False)            # conversion to PyTorch tensor with no copy (default)\n",{"type":46,"tag":304,"props":351,"children":353},{"class":306,"line":352},6,[354],{"type":46,"tag":304,"props":355,"children":356},{},[357],{"type":51,"value":358},"t[1:3]                         # slicing supported\n",{"type":46,"tag":304,"props":360,"children":362},{"class":306,"line":361},7,[363],{"type":46,"tag":304,"props":364,"children":365},{},[366],{"type":51,"value":367},"np.asarray(t)                  # NumPy via __array__ (CPU only)\n",{"type":46,"tag":61,"props":369,"children":370},{},[371,373,379,380,386,387,393],{"type":51,"value":372},"Supports ",{"type":46,"tag":67,"props":374,"children":376},{"className":375},[],[377],{"type":51,"value":378},"__dlpack__",{"type":51,"value":120},{"type":46,"tag":67,"props":381,"children":383},{"className":382},[],[384],{"type":51,"value":385},"__cuda_array_interface__",{"type":51,"value":120},{"type":46,"tag":67,"props":388,"children":390},{"className":389},[],[391],{"type":51,"value":392},"__array__",{"type":51,"value":394},", arithmetic operators.",{"type":46,"tag":287,"props":396,"children":398},{"id":397},"batch-collection-of-samples-variable-shapes-ok",[399],{"type":51,"value":400},"Batch -- collection of samples (variable shapes OK)",{"type":46,"tag":294,"props":402,"children":404},{"className":296,"code":403,"language":40,"meta":298,"style":298},"b = ndd.batch([arr1, arr2])    # copy\nb = ndd.as_batch(data)         # wrap, no copy if possible\n",[405],{"type":46,"tag":67,"props":406,"children":407},{"__ignoreMap":298},[408,416],{"type":46,"tag":304,"props":409,"children":410},{"class":306,"line":307},[411],{"type":46,"tag":304,"props":412,"children":413},{},[414],{"type":51,"value":415},"b = ndd.batch([arr1, arr2])    # copy\n",{"type":46,"tag":304,"props":417,"children":418},{"class":306,"line":316},[419],{"type":46,"tag":304,"props":420,"children":421},{},[422],{"type":51,"value":423},"b = ndd.as_batch(data)         # wrap, no copy if possible\n",{"type":46,"tag":61,"props":425,"children":426},{},[427,439,441,447,449,455],{"type":46,"tag":428,"props":429,"children":430},"strong",{},[431,433],{"type":51,"value":432},"Batch has no ",{"type":46,"tag":67,"props":434,"children":436},{"className":435},[],[437],{"type":51,"value":438},"__getitem__",{"type":51,"value":440}," -- ",{"type":46,"tag":67,"props":442,"children":444},{"className":443},[],[445],{"type":51,"value":446},"batch[i]",{"type":51,"value":448}," raises ",{"type":46,"tag":67,"props":450,"children":452},{"className":451},[],[453],{"type":51,"value":454},"TypeError",{"type":51,"value":456}," because indexing is ambiguous (sample selection vs. per-sample slicing). Use the explicit APIs instead:",{"type":46,"tag":458,"props":459,"children":460},"table",{},[461,485],{"type":46,"tag":462,"props":463,"children":464},"thead",{},[465],{"type":46,"tag":466,"props":467,"children":468},"tr",{},[469,475,480],{"type":46,"tag":470,"props":471,"children":472},"th",{},[473],{"type":51,"value":474},"Intent",{"type":46,"tag":470,"props":476,"children":477},{},[478],{"type":51,"value":479},"Method",{"type":46,"tag":470,"props":481,"children":482},{},[483],{"type":51,"value":484},"Returns",{"type":46,"tag":486,"props":487,"children":488},"tbody",{},[489,516,542,569],{"type":46,"tag":466,"props":490,"children":491},{},[492,498,507],{"type":46,"tag":493,"props":494,"children":495},"td",{},[496],{"type":51,"value":497},"Get sample i",{"type":46,"tag":493,"props":499,"children":500},{},[501],{"type":46,"tag":67,"props":502,"children":504},{"className":503},[],[505],{"type":51,"value":506},"batch.tensors[i]",{"type":46,"tag":493,"props":508,"children":509},{},[510],{"type":46,"tag":67,"props":511,"children":513},{"className":512},[],[514],{"type":51,"value":515},"Tensor",{"type":46,"tag":466,"props":517,"children":518},{},[519,524,533],{"type":46,"tag":493,"props":520,"children":521},{},[522],{"type":51,"value":523},"Get subset of samples",{"type":46,"tag":493,"props":525,"children":526},{},[527],{"type":46,"tag":67,"props":528,"children":530},{"className":529},[],[531],{"type":51,"value":532},"batch.tensors[slice_or_list]",{"type":46,"tag":493,"props":534,"children":535},{},[536],{"type":46,"tag":67,"props":537,"children":539},{"className":538},[],[540],{"type":51,"value":541},"Batch",{"type":46,"tag":466,"props":543,"children":544},{},[545,550,559],{"type":46,"tag":493,"props":546,"children":547},{},[548],{"type":51,"value":549},"Slice within each sample",{"type":46,"tag":493,"props":551,"children":552},{},[553],{"type":46,"tag":67,"props":554,"children":556},{"className":555},[],[557],{"type":51,"value":558},"batch.slice[...]",{"type":46,"tag":493,"props":560,"children":561},{},[562,567],{"type":46,"tag":67,"props":563,"children":565},{"className":564},[],[566],{"type":51,"value":541},{"type":51,"value":568}," (same batch_size)",{"type":46,"tag":466,"props":570,"children":571},{},[572,577,586],{"type":46,"tag":493,"props":573,"children":574},{},[575],{"type":51,"value":576},"Sample-wise slicing",{"type":46,"tag":493,"props":578,"children":579},{},[580],{"type":46,"tag":67,"props":581,"children":583},{"className":582},[],[584],{"type":51,"value":585},"batch.slice[batch_of_indices]",{"type":46,"tag":493,"props":587,"children":588},{},[589,594],{"type":46,"tag":67,"props":590,"children":592},{"className":591},[],[593],{"type":51,"value":541},{"type":51,"value":568},{"type":46,"tag":61,"props":596,"children":597},{},[598,604,606,611,613,619,621,626],{"type":46,"tag":67,"props":599,"children":601},{"className":600},[],[602],{"type":51,"value":603},".tensors[]",{"type":51,"value":605}," picks ",{"type":46,"tag":428,"props":607,"children":608},{},[609],{"type":51,"value":610},"which samples",{"type":51,"value":612},". ",{"type":46,"tag":67,"props":614,"children":616},{"className":615},[],[617],{"type":51,"value":618},".slice",{"type":51,"value":620}," indexes ",{"type":46,"tag":428,"props":622,"children":623},{},[624],{"type":51,"value":625},"inside each sample",{"type":51,"value":143},{"type":46,"tag":294,"props":628,"children":630},{"className":296,"code":629,"language":40,"meta":298,"style":298},"xy = ndd.random.uniform(batch_size=16, range=[0, 1], shape=2)\ncrop_x = xy.slice[0]       # Batch of 16 scalars, first element from each sample\ncrop_y = xy.slice[1]       # Batch of 16 scalars, second element from each sample\nsample_0 = xy.tensors[0]   # Tensor, the entire first sample [x, y]\n",[631],{"type":46,"tag":67,"props":632,"children":633},{"__ignoreMap":298},[634,642,650,658],{"type":46,"tag":304,"props":635,"children":636},{"class":306,"line":307},[637],{"type":46,"tag":304,"props":638,"children":639},{},[640],{"type":51,"value":641},"xy = ndd.random.uniform(batch_size=16, range=[0, 1], shape=2)\n",{"type":46,"tag":304,"props":643,"children":644},{"class":306,"line":316},[645],{"type":46,"tag":304,"props":646,"children":647},{},[648],{"type":51,"value":649},"crop_x = xy.slice[0]       # Batch of 16 scalars, first element from each sample\n",{"type":46,"tag":304,"props":651,"children":652},{"class":306,"line":325},[653],{"type":46,"tag":304,"props":654,"children":655},{},[656],{"type":51,"value":657},"crop_y = xy.slice[1]       # Batch of 16 scalars, second element from each sample\n",{"type":46,"tag":304,"props":659,"children":660},{"class":306,"line":334},[661],{"type":46,"tag":304,"props":662,"children":663},{},[664],{"type":51,"value":665},"sample_0 = xy.tensors[0]   # Tensor, the entire first sample [x, y]\n",{"type":46,"tag":287,"props":667,"children":669},{"id":668},"advanced-slicing",[670],{"type":51,"value":671},"Advanced slicing",{"type":46,"tag":61,"props":673,"children":674},{},[675,677,683],{"type":51,"value":676},"The ",{"type":46,"tag":67,"props":678,"children":680},{"className":679},[],[681],{"type":51,"value":682},".slice[]",{"type":51,"value":684}," API accepts batches of indices, allowing the user to mix and match batches and\nscalar values, e.g.:",{"type":46,"tag":294,"props":686,"children":688},{"className":296,"code":687,"language":40,"meta":298,"style":298},"imgs = ndd.imread(filenames)  # a batch of images, if `filenames` is a list\nsliced = imgs.slice[\n    42 :  # the range start is broadcast to all samples\n    ndd.batch(imgs.shape).slice[0] \u002F\u002F 2  # per-sample range stop (half of each image)\n]\n",[689],{"type":46,"tag":67,"props":690,"children":691},{"__ignoreMap":298},[692,700,708,716,724],{"type":46,"tag":304,"props":693,"children":694},{"class":306,"line":307},[695],{"type":46,"tag":304,"props":696,"children":697},{},[698],{"type":51,"value":699},"imgs = ndd.imread(filenames)  # a batch of images, if `filenames` is a list\n",{"type":46,"tag":304,"props":701,"children":702},{"class":306,"line":316},[703],{"type":46,"tag":304,"props":704,"children":705},{},[706],{"type":51,"value":707},"sliced = imgs.slice[\n",{"type":46,"tag":304,"props":709,"children":710},{"class":306,"line":325},[711],{"type":46,"tag":304,"props":712,"children":713},{},[714],{"type":51,"value":715},"    42 :  # the range start is broadcast to all samples\n",{"type":46,"tag":304,"props":717,"children":718},{"class":306,"line":334},[719],{"type":46,"tag":304,"props":720,"children":721},{},[722],{"type":51,"value":723},"    ndd.batch(imgs.shape).slice[0] \u002F\u002F 2  # per-sample range stop (half of each image)\n",{"type":46,"tag":304,"props":725,"children":726},{"class":306,"line":343},[727],{"type":46,"tag":304,"props":728,"children":729},{},[730],{"type":51,"value":731},"]\n",{"type":46,"tag":61,"props":733,"children":734},{},[735],{"type":46,"tag":428,"props":736,"children":737},{},[738],{"type":51,"value":739},"PyTorch conversion:",{"type":46,"tag":89,"props":741,"children":742},{},[743,754,765,776,817],{"type":46,"tag":93,"props":744,"children":745},{},[746,752],{"type":46,"tag":67,"props":747,"children":749},{"className":748},[],[750],{"type":51,"value":751},"batch.torch()",{"type":51,"value":753}," -- works for uniform shapes; raises for ragged batches",{"type":46,"tag":93,"props":755,"children":756},{},[757,763],{"type":46,"tag":67,"props":758,"children":760},{"className":759},[],[761],{"type":51,"value":762},"batch.torch(pad=True)",{"type":51,"value":764}," -- zero-pads ragged batches to max shape (use for variable-length audio, detection boxes, etc.)",{"type":46,"tag":93,"props":766,"children":767},{},[768,774],{"type":46,"tag":67,"props":769,"children":771},{"className":770},[],[772],{"type":51,"value":773},"batch.torch(copy=None)",{"type":51,"value":775}," is the default (avoids copy if possible)",{"type":46,"tag":93,"props":777,"children":778},{},[779,781,791,793,799,801,807,809,815],{"type":51,"value":780},"Batch has ",{"type":46,"tag":428,"props":782,"children":783},{},[784,786],{"type":51,"value":785},"no ",{"type":46,"tag":67,"props":787,"children":789},{"className":788},[],[790],{"type":51,"value":378},{"type":51,"value":792}," -- use ",{"type":46,"tag":67,"props":794,"children":796},{"className":795},[],[797],{"type":51,"value":798},"ndd.as_tensor(batch)",{"type":51,"value":800}," first for DLPack consumers. ",{"type":46,"tag":67,"props":802,"children":804},{"className":803},[],[805],{"type":51,"value":806},"ndd.as_tensor",{"type":51,"value":808}," supports ",{"type":46,"tag":67,"props":810,"children":812},{"className":811},[],[813],{"type":51,"value":814},"pad",{"type":51,"value":816}," as well.",{"type":46,"tag":93,"props":818,"children":819},{},[820,826],{"type":46,"tag":67,"props":821,"children":823},{"className":822},[],[824],{"type":51,"value":825},"Tensor.torch(copy=False)",{"type":51,"value":827}," is default (no copy)",{"type":46,"tag":61,"props":829,"children":830},{},[831,836,838,844],{"type":46,"tag":428,"props":832,"children":833},{},[834],{"type":51,"value":835},"Iteration:",{"type":51,"value":837}," ",{"type":46,"tag":67,"props":839,"children":841},{"className":840},[],[842],{"type":51,"value":843},"for sample in batch:",{"type":51,"value":845}," yields Tensors.",{"type":46,"tag":54,"props":847,"children":849},{"id":848},"readers",[850],{"type":51,"value":851},"Readers",{"type":46,"tag":61,"props":853,"children":854},{},[855,857,862],{"type":51,"value":856},"Readers are ",{"type":46,"tag":428,"props":858,"children":859},{},[860],{"type":51,"value":861},"stateful objects",{"type":51,"value":863}," -- create once, reuse across epochs. This matters because readers track internal state like shuffle order and shard position.",{"type":46,"tag":294,"props":865,"children":867},{"className":296,"code":866,"language":40,"meta":298,"style":298},"reader = ndd.readers.File(file_root=image_dir, random_shuffle=True)\n\nfor epoch in range(num_epochs):\n    for jpegs, labels in reader.next_epoch(batch_size=64):\n        # jpegs, labels are Batch objects\n        ...\n",[868],{"type":46,"tag":67,"props":869,"children":870},{"__ignoreMap":298},[871,879,888,896,904,912],{"type":46,"tag":304,"props":872,"children":873},{"class":306,"line":307},[874],{"type":46,"tag":304,"props":875,"children":876},{},[877],{"type":51,"value":878},"reader = ndd.readers.File(file_root=image_dir, random_shuffle=True)\n",{"type":46,"tag":304,"props":880,"children":881},{"class":306,"line":316},[882],{"type":46,"tag":304,"props":883,"children":885},{"emptyLinePlaceholder":884},true,[886],{"type":51,"value":887},"\n",{"type":46,"tag":304,"props":889,"children":890},{"class":306,"line":325},[891],{"type":46,"tag":304,"props":892,"children":893},{},[894],{"type":51,"value":895},"for epoch in range(num_epochs):\n",{"type":46,"tag":304,"props":897,"children":898},{"class":306,"line":334},[899],{"type":46,"tag":304,"props":900,"children":901},{},[902],{"type":51,"value":903},"    for jpegs, labels in reader.next_epoch(batch_size=64):\n",{"type":46,"tag":304,"props":905,"children":906},{"class":306,"line":343},[907],{"type":46,"tag":304,"props":908,"children":909},{},[910],{"type":51,"value":911},"        # jpegs, labels are Batch objects\n",{"type":46,"tag":304,"props":913,"children":914},{"class":306,"line":352},[915],{"type":46,"tag":304,"props":916,"children":917},{},[918],{"type":51,"value":919},"        ...\n",{"type":46,"tag":61,"props":921,"children":922},{},[923],{"type":51,"value":924},"Key points:",{"type":46,"tag":89,"props":926,"children":927},{},[928,947,979,997,1027,1046],{"type":46,"tag":93,"props":929,"children":930},{},[931,933,938,940,946],{"type":51,"value":932},"Reader outputs (jpegs, labels, etc.) are ",{"type":46,"tag":428,"props":934,"children":935},{},[936],{"type":51,"value":937},"CPU",{"type":51,"value":939}," tensors\u002Fbatches. Labels typically stay on CPU until you convert them for your framework (e.g. ",{"type":46,"tag":67,"props":941,"children":943},{"className":942},[],[944],{"type":51,"value":945},"labels.torch().to(device)",{"type":51,"value":81},{"type":46,"tag":93,"props":948,"children":949},{},[950,952,957,959,965,966,972,973],{"type":51,"value":951},"Reader classes are ",{"type":46,"tag":428,"props":953,"children":954},{},[955],{"type":51,"value":956},"PascalCase",{"type":51,"value":958},": ",{"type":46,"tag":67,"props":960,"children":962},{"className":961},[],[963],{"type":51,"value":964},"ndd.readers.File(...)",{"type":51,"value":120},{"type":46,"tag":67,"props":967,"children":969},{"className":968},[],[970],{"type":51,"value":971},"ndd.readers.COCO(...)",{"type":51,"value":120},{"type":46,"tag":67,"props":974,"children":976},{"className":975},[],[977],{"type":51,"value":978},"ndd.readers.TFRecord(...)",{"type":46,"tag":93,"props":980,"children":981},{},[982,987,989,995],{"type":46,"tag":67,"props":983,"children":985},{"className":984},[],[986],{"type":51,"value":154},{"type":51,"value":988}," goes to ",{"type":46,"tag":67,"props":990,"children":992},{"className":991},[],[993],{"type":51,"value":994},"next_epoch()",{"type":51,"value":996},", not to the reader constructor",{"type":46,"tag":93,"props":998,"children":999},{},[1000,1006,1008,1013,1015,1020,1022],{"type":46,"tag":67,"props":1001,"children":1003},{"className":1002},[],[1004],{"type":51,"value":1005},"next_epoch(batch_size=N)",{"type":51,"value":1007}," yields tuples of ",{"type":46,"tag":67,"props":1009,"children":1011},{"className":1010},[],[1012],{"type":51,"value":541},{"type":51,"value":1014},"; ",{"type":46,"tag":67,"props":1016,"children":1018},{"className":1017},[],[1019],{"type":51,"value":994},{"type":51,"value":1021}," without batch_size yields tuples of ",{"type":46,"tag":67,"props":1023,"children":1025},{"className":1024},[],[1026],{"type":51,"value":515},{"type":46,"tag":93,"props":1028,"children":1029},{},[1030,1032,1037,1039,1044],{"type":51,"value":1031},"The iterator from ",{"type":46,"tag":67,"props":1033,"children":1035},{"className":1034},[],[1036],{"type":51,"value":994},{"type":51,"value":1038}," must be fully consumed before calling ",{"type":46,"tag":67,"props":1040,"children":1042},{"className":1041},[],[1043],{"type":51,"value":994},{"type":51,"value":1045}," again",{"type":46,"tag":93,"props":1047,"children":1048},{},[1049],{"type":51,"value":1050},"Once a reader is used with a given batch_size, it cannot be changed. Similarly, a reader used in batch mode cannot switch to sample mode or vice versa.",{"type":46,"tag":61,"props":1052,"children":1053},{},[1054],{"type":51,"value":1055},"Sharded reading for distributed training:",{"type":46,"tag":294,"props":1057,"children":1059},{"className":296,"code":1058,"language":40,"meta":298,"style":298},"reader = ndd.readers.File(\n    file_root=image_dir,\n    shard_id=rank, num_shards=world_size,\n    stick_to_shard=True,\n    pad_last_batch=True,\n)\n",[1060],{"type":46,"tag":67,"props":1061,"children":1062},{"__ignoreMap":298},[1063,1071,1079,1087,1095,1103],{"type":46,"tag":304,"props":1064,"children":1065},{"class":306,"line":307},[1066],{"type":46,"tag":304,"props":1067,"children":1068},{},[1069],{"type":51,"value":1070},"reader = ndd.readers.File(\n",{"type":46,"tag":304,"props":1072,"children":1073},{"class":306,"line":316},[1074],{"type":46,"tag":304,"props":1075,"children":1076},{},[1077],{"type":51,"value":1078},"    file_root=image_dir,\n",{"type":46,"tag":304,"props":1080,"children":1081},{"class":306,"line":325},[1082],{"type":46,"tag":304,"props":1083,"children":1084},{},[1085],{"type":51,"value":1086},"    shard_id=rank, num_shards=world_size,\n",{"type":46,"tag":304,"props":1088,"children":1089},{"class":306,"line":334},[1090],{"type":46,"tag":304,"props":1091,"children":1092},{},[1093],{"type":51,"value":1094},"    stick_to_shard=True,\n",{"type":46,"tag":304,"props":1096,"children":1097},{"class":306,"line":343},[1098],{"type":46,"tag":304,"props":1099,"children":1100},{},[1101],{"type":51,"value":1102},"    pad_last_batch=True,\n",{"type":46,"tag":304,"props":1104,"children":1105},{"class":306,"line":352},[1106],{"type":46,"tag":304,"props":1107,"children":1108},{},[1109],{"type":51,"value":1110},")\n",{"type":46,"tag":54,"props":1112,"children":1114},{"id":1113},"device-handling",[1115],{"type":51,"value":1116},"Device Handling",{"type":46,"tag":89,"props":1118,"children":1119},{},[1120,1132,1165,1198],{"type":46,"tag":93,"props":1121,"children":1122},{},[1123,1125,1130],{"type":51,"value":1124},"Device is ",{"type":46,"tag":428,"props":1126,"children":1127},{},[1128],{"type":51,"value":1129},"inferred from inputs",{"type":51,"value":1131}," -- GPU if any input is on GPU",{"type":46,"tag":93,"props":1133,"children":1134},{},[1135,1137,1142,1144,1149,1151,1156,1158,1163],{"type":51,"value":1136},"For hybrid decode: use ",{"type":46,"tag":67,"props":1138,"children":1140},{"className":1139},[],[1141],{"type":51,"value":186},{"type":51,"value":1143}," (NOT ",{"type":46,"tag":67,"props":1145,"children":1147},{"className":1146},[],[1148],{"type":51,"value":194},{"type":51,"value":1150},"). The ",{"type":46,"tag":67,"props":1152,"children":1154},{"className":1153},[],[1155],{"type":51,"value":194},{"type":51,"value":1157}," keyword is a pipeline-mode concept for implicit CPU-to-GPU transfer; in dynamic mode, passing ",{"type":46,"tag":67,"props":1159,"children":1161},{"className":1160},[],[1162],{"type":51,"value":186},{"type":51,"value":1164}," triggers the same hardware-accelerated decode path.",{"type":46,"tag":93,"props":1166,"children":1167},{},[1168,1170,1176,1178,1183,1185,1190,1192,1197],{"type":51,"value":1169},"Don't call ",{"type":46,"tag":67,"props":1171,"children":1173},{"className":1172},[],[1174],{"type":51,"value":1175},".cpu()",{"type":51,"value":1177}," before passing to a GPU model -- ",{"type":46,"tag":67,"props":1179,"children":1181},{"className":1180},[],[1182],{"type":51,"value":222},{"type":51,"value":1184}," gives you a GPU tensor directly. ",{"type":46,"tag":67,"props":1186,"children":1188},{"className":1187},[],[1189],{"type":51,"value":1175},{"type":51,"value":1191}," is only needed for consumers requiring host memory (numpy, ",{"type":46,"tag":67,"props":1193,"children":1195},{"className":1194},[],[1196],{"type":51,"value":392},{"type":51,"value":81},{"type":46,"tag":93,"props":1199,"children":1200},{},[1201,1203,1208],{"type":51,"value":1202},"CUDA stream sync between DALI and PyTorch is ",{"type":46,"tag":428,"props":1204,"children":1205},{},[1206],{"type":51,"value":1207},"automatic via DLPack",{"type":51,"value":1209}," -- no manual stream management needed.",{"type":46,"tag":54,"props":1211,"children":1213},{"id":1212},"execution-model",[1214],{"type":51,"value":1215},"Execution Model",{"type":46,"tag":61,"props":1217,"children":1218},{},[1219,1221,1227],{"type":51,"value":1220},"Default mode is ",{"type":46,"tag":67,"props":1222,"children":1224},{"className":1223},[],[1225],{"type":51,"value":1226},"eager",{"type":51,"value":1228}," -- async execution in a background thread, returns immediately.",{"type":46,"tag":61,"props":1230,"children":1231},{},[1232,1245,1247,1252,1253,1258,1259,1264,1265,1271],{"type":46,"tag":428,"props":1233,"children":1234},{},[1235,1237,1243],{"type":51,"value":1236},"No ",{"type":46,"tag":67,"props":1238,"children":1240},{"className":1239},[],[1241],{"type":51,"value":1242},".evaluate()",{"type":51,"value":1244}," needed in most cases.",{"type":51,"value":1246}," Any data consumption (",{"type":46,"tag":67,"props":1248,"children":1250},{"className":1249},[],[1251],{"type":51,"value":222},{"type":51,"value":120},{"type":46,"tag":67,"props":1254,"children":1256},{"className":1255},[],[1257],{"type":51,"value":378},{"type":51,"value":120},{"type":46,"tag":67,"props":1260,"children":1262},{"className":1261},[],[1263],{"type":51,"value":392},{"type":51,"value":120},{"type":46,"tag":67,"props":1266,"children":1268},{"className":1267},[],[1269],{"type":51,"value":1270},".shape",{"type":51,"value":1272},", property access, iteration) triggers evaluation automatically.",{"type":46,"tag":61,"props":1274,"children":1275},{},[1276],{"type":51,"value":1277},"For debugging, switch to synchronous mode so errors surface at the exact call site rather than later in the async queue:",{"type":46,"tag":294,"props":1279,"children":1281},{"className":296,"code":1280,"language":40,"meta":298,"style":298},"with ndd.EvalMode.sync_cpu:\n    images = ndd.decoders.image(jpegs, device=\"gpu\")\n    images = ndd.resize(images, size=[224, 224])\n    # Any error surfaces here, at the exact op that failed\n",[1282],{"type":46,"tag":67,"props":1283,"children":1284},{"__ignoreMap":298},[1285,1293,1301,1309],{"type":46,"tag":304,"props":1286,"children":1287},{"class":306,"line":307},[1288],{"type":46,"tag":304,"props":1289,"children":1290},{},[1291],{"type":51,"value":1292},"with ndd.EvalMode.sync_cpu:\n",{"type":46,"tag":304,"props":1294,"children":1295},{"class":306,"line":316},[1296],{"type":46,"tag":304,"props":1297,"children":1298},{},[1299],{"type":51,"value":1300},"    images = ndd.decoders.image(jpegs, device=\"gpu\")\n",{"type":46,"tag":304,"props":1302,"children":1303},{"class":306,"line":325},[1304],{"type":46,"tag":304,"props":1305,"children":1306},{},[1307],{"type":51,"value":1308},"    images = ndd.resize(images, size=[224, 224])\n",{"type":46,"tag":304,"props":1310,"children":1311},{"class":306,"line":334},[1312],{"type":46,"tag":304,"props":1313,"children":1314},{},[1315],{"type":51,"value":1316},"    # Any error surfaces here, at the exact op that failed\n",{"type":46,"tag":61,"props":1318,"children":1319},{},[1320,1322,1328,1330,1335,1336,1342,1343],{"type":51,"value":1321},"Modes (increasing synchronicity): ",{"type":46,"tag":67,"props":1323,"children":1325},{"className":1324},[],[1326],{"type":51,"value":1327},"deferred",{"type":51,"value":1329}," \u003C ",{"type":46,"tag":67,"props":1331,"children":1333},{"className":1332},[],[1334],{"type":51,"value":1226},{"type":51,"value":1329},{"type":46,"tag":67,"props":1337,"children":1339},{"className":1338},[],[1340],{"type":51,"value":1341},"sync_cpu",{"type":51,"value":1329},{"type":46,"tag":67,"props":1344,"children":1346},{"className":1345},[],[1347],{"type":51,"value":1348},"sync_full",{"type":46,"tag":61,"props":1350,"children":1351},{},[1352,1353,1359,1361,1366,1368,1373,1375,1380],{"type":51,"value":216},{"type":46,"tag":67,"props":1354,"children":1356},{"className":1355},[],[1357],{"type":51,"value":1358},"EvalMode.sync_full",{"type":51,"value":1360}," for debugging instead of scattering ",{"type":46,"tag":67,"props":1362,"children":1364},{"className":1363},[],[1365],{"type":51,"value":1242},{"type":51,"value":1367}," calls -- it's cleaner and catches all issues at once. ",{"type":46,"tag":67,"props":1369,"children":1371},{"className":1370},[],[1372],{"type":51,"value":1341},{"type":51,"value":1374}," is often sufficient and lighter than ",{"type":46,"tag":67,"props":1376,"children":1378},{"className":1377},[],[1379],{"type":51,"value":1348},{"type":51,"value":143},{"type":46,"tag":54,"props":1382,"children":1384},{"id":1383},"thread-configuration",[1385],{"type":51,"value":1386},"Thread Configuration",{"type":46,"tag":294,"props":1388,"children":1390},{"className":296,"code":1389,"language":40,"meta":298,"style":298},"ndd.set_num_threads(4)  # Call once at startup, only if necessary to override the defaults\n",[1391],{"type":46,"tag":67,"props":1392,"children":1393},{"__ignoreMap":298},[1394],{"type":46,"tag":304,"props":1395,"children":1396},{"class":306,"line":307},[1397],{"type":46,"tag":304,"props":1398,"children":1399},{},[1400],{"type":51,"value":1389},{"type":46,"tag":61,"props":1402,"children":1403},{},[1404,1406,1412],{"type":51,"value":1405},"Controls DALI's internal worker threads for CPU operators. Defaults to CPU affinity count or ",{"type":46,"tag":67,"props":1407,"children":1409},{"className":1408},[],[1410],{"type":51,"value":1411},"DALI_NUM_THREADS",{"type":51,"value":1413}," env var. Unrelated to Python-level threading.",{"type":46,"tag":54,"props":1415,"children":1417},{"id":1416},"rng",[1418],{"type":51,"value":1419},"RNG",{"type":46,"tag":61,"props":1421,"children":1422},{},[1423],{"type":51,"value":1424},"Two approaches (use one, not both):",{"type":46,"tag":294,"props":1426,"children":1428},{"className":296,"code":1427,"language":40,"meta":298,"style":298},"# Approach 1: set the thread-local default seed (simple, good enough for most cases)\nndd.random.set_seed(42)\nangles = ndd.random.uniform(batch_size=64, range=(-30, 30))\n\n# Approach 2: explicit RNG object (finer control, pass rng= to each op)\nrng = ndd.random.RNG(seed=42)\nvalues = ndd.random.uniform(batch_size=64, range=[0, 1], shape=2, rng=rng)\n",[1429],{"type":46,"tag":67,"props":1430,"children":1431},{"__ignoreMap":298},[1432,1440,1448,1456,1463,1471,1479],{"type":46,"tag":304,"props":1433,"children":1434},{"class":306,"line":307},[1435],{"type":46,"tag":304,"props":1436,"children":1437},{},[1438],{"type":51,"value":1439},"# Approach 1: set the thread-local default seed (simple, good enough for most cases)\n",{"type":46,"tag":304,"props":1441,"children":1442},{"class":306,"line":316},[1443],{"type":46,"tag":304,"props":1444,"children":1445},{},[1446],{"type":51,"value":1447},"ndd.random.set_seed(42)\n",{"type":46,"tag":304,"props":1449,"children":1450},{"class":306,"line":325},[1451],{"type":46,"tag":304,"props":1452,"children":1453},{},[1454],{"type":51,"value":1455},"angles = ndd.random.uniform(batch_size=64, range=(-30, 30))\n",{"type":46,"tag":304,"props":1457,"children":1458},{"class":306,"line":334},[1459],{"type":46,"tag":304,"props":1460,"children":1461},{"emptyLinePlaceholder":884},[1462],{"type":51,"value":887},{"type":46,"tag":304,"props":1464,"children":1465},{"class":306,"line":343},[1466],{"type":46,"tag":304,"props":1467,"children":1468},{},[1469],{"type":51,"value":1470},"# Approach 2: explicit RNG object (finer control, pass rng= to each op)\n",{"type":46,"tag":304,"props":1472,"children":1473},{"class":306,"line":352},[1474],{"type":46,"tag":304,"props":1475,"children":1476},{},[1477],{"type":51,"value":1478},"rng = ndd.random.RNG(seed=42)\n",{"type":46,"tag":304,"props":1480,"children":1481},{"class":306,"line":361},[1482],{"type":46,"tag":304,"props":1483,"children":1484},{},[1485],{"type":51,"value":1486},"values = ndd.random.uniform(batch_size=64, range=[0, 1], shape=2, rng=rng)\n",{"type":46,"tag":61,"props":1488,"children":1489},{},[1490,1492,1498],{"type":51,"value":1491},"When ",{"type":46,"tag":67,"props":1493,"children":1495},{"className":1494},[],[1496],{"type":51,"value":1497},"rng=",{"type":51,"value":1499}," is passed to a random op, the explicit RNG overrides the default seed. Thread-local: each thread has independent random state.",{"type":46,"tag":61,"props":1501,"children":1502},{},[1503,1505,1510],{"type":51,"value":1504},"Random ops need an explicit ",{"type":46,"tag":67,"props":1506,"children":1508},{"className":1507},[],[1509],{"type":51,"value":154},{"type":51,"value":1511}," when working with batches -- there is no pipeline-level batch size to inherit.",{"type":46,"tag":54,"props":1513,"children":1515},{"id":1514},"checkpointing",[1516],{"type":51,"value":1517},"Checkpointing",{"type":46,"tag":61,"props":1519,"children":1520},{},[1521,1523,1528,1530,1535],{"type":51,"value":1522},"Dynamic mode has ",{"type":46,"tag":428,"props":1524,"children":1525},{},[1526],{"type":51,"value":1527},"no pipeline-level checkpoint",{"type":51,"value":1529},". Checkpoints aggregate the state of individual stateful objects: readers and ",{"type":46,"tag":67,"props":1531,"children":1533},{"className":1532},[],[1534],{"type":51,"value":1419},{"type":51,"value":1536}," instances. Stateless ops (decoders, resize, rotate, normalize, ...) are not part of a checkpoint.",{"type":46,"tag":294,"props":1538,"children":1540},{"className":296,"code":1539,"language":40,"meta":298,"style":298},"ckpt = ndd.checkpoint.Checkpoint()\nckpt.register(reader, \"my_reader\")\nckpt.register(rng, \"rng\")\n\n# ... iterate for a while ...\n\nckpt.collect()                       # snapshot the registered objects\nckpt.save(\"ckpt_{seq:04d}.json\")     # writes ckpt_0000.json, ckpt_0001.json, ...\n",[1541],{"type":46,"tag":67,"props":1542,"children":1543},{"__ignoreMap":298},[1544,1552,1560,1568,1575,1583,1590,1598],{"type":46,"tag":304,"props":1545,"children":1546},{"class":306,"line":307},[1547],{"type":46,"tag":304,"props":1548,"children":1549},{},[1550],{"type":51,"value":1551},"ckpt = ndd.checkpoint.Checkpoint()\n",{"type":46,"tag":304,"props":1553,"children":1554},{"class":306,"line":316},[1555],{"type":46,"tag":304,"props":1556,"children":1557},{},[1558],{"type":51,"value":1559},"ckpt.register(reader, \"my_reader\")\n",{"type":46,"tag":304,"props":1561,"children":1562},{"class":306,"line":325},[1563],{"type":46,"tag":304,"props":1564,"children":1565},{},[1566],{"type":51,"value":1567},"ckpt.register(rng, \"rng\")\n",{"type":46,"tag":304,"props":1569,"children":1570},{"class":306,"line":334},[1571],{"type":46,"tag":304,"props":1572,"children":1573},{"emptyLinePlaceholder":884},[1574],{"type":51,"value":887},{"type":46,"tag":304,"props":1576,"children":1577},{"class":306,"line":343},[1578],{"type":46,"tag":304,"props":1579,"children":1580},{},[1581],{"type":51,"value":1582},"# ... iterate for a while ...\n",{"type":46,"tag":304,"props":1584,"children":1585},{"class":306,"line":352},[1586],{"type":46,"tag":304,"props":1587,"children":1588},{"emptyLinePlaceholder":884},[1589],{"type":51,"value":887},{"type":46,"tag":304,"props":1591,"children":1592},{"class":306,"line":361},[1593],{"type":46,"tag":304,"props":1594,"children":1595},{},[1596],{"type":51,"value":1597},"ckpt.collect()                       # snapshot the registered objects\n",{"type":46,"tag":304,"props":1599,"children":1601},{"class":306,"line":1600},8,[1602],{"type":46,"tag":304,"props":1603,"children":1604},{},[1605],{"type":51,"value":1606},"ckpt.save(\"ckpt_{seq:04d}.json\")     # writes ckpt_0000.json, ckpt_0001.json, ...\n",{"type":46,"tag":61,"props":1608,"children":1609},{},[1610,1612,1618,1620,1625,1627,1633,1635,1641,1643,1648],{"type":51,"value":1611},"Restoring is the symmetric operation -- build a ",{"type":46,"tag":1613,"props":1614,"children":1615},"em",{},[1616],{"type":51,"value":1617},"fresh",{"type":51,"value":1619}," reader and ",{"type":46,"tag":67,"props":1621,"children":1623},{"className":1622},[],[1624],{"type":51,"value":1419},{"type":51,"value":1626},", then ",{"type":46,"tag":67,"props":1628,"children":1630},{"className":1629},[],[1631],{"type":51,"value":1632},"load",{"type":51,"value":1634}," + ",{"type":46,"tag":67,"props":1636,"children":1638},{"className":1637},[],[1639],{"type":51,"value":1640},"register",{"type":51,"value":1642},". The loaded state is applied to each object at ",{"type":46,"tag":67,"props":1644,"children":1646},{"className":1645},[],[1647],{"type":51,"value":1640},{"type":51,"value":1649}," time:",{"type":46,"tag":294,"props":1651,"children":1653},{"className":296,"code":1652,"language":40,"meta":298,"style":298},"reader = ndd.readers.File(file_root=..., enable_checkpointing=True, name=\"my_reader\")\nrng = ndd.random.RNG()\n\nckpt = ndd.checkpoint.Checkpoint()\nckpt.load(\"ckpt_{seq:04d}.json\")     # picks the highest sequence number\nckpt.register(reader, \"my_reader\")   # state applied here\nckpt.register(rng, \"rng\")            # ditto\n\nfor batch in reader.next_epoch(batch_size=N):\n    ...  # produces the next batch after the checkpointed iteration\n",[1654],{"type":46,"tag":67,"props":1655,"children":1656},{"__ignoreMap":298},[1657,1665,1673,1680,1687,1695,1703,1711,1718,1727],{"type":46,"tag":304,"props":1658,"children":1659},{"class":306,"line":307},[1660],{"type":46,"tag":304,"props":1661,"children":1662},{},[1663],{"type":51,"value":1664},"reader = ndd.readers.File(file_root=..., enable_checkpointing=True, name=\"my_reader\")\n",{"type":46,"tag":304,"props":1666,"children":1667},{"class":306,"line":316},[1668],{"type":46,"tag":304,"props":1669,"children":1670},{},[1671],{"type":51,"value":1672},"rng = ndd.random.RNG()\n",{"type":46,"tag":304,"props":1674,"children":1675},{"class":306,"line":325},[1676],{"type":46,"tag":304,"props":1677,"children":1678},{"emptyLinePlaceholder":884},[1679],{"type":51,"value":887},{"type":46,"tag":304,"props":1681,"children":1682},{"class":306,"line":334},[1683],{"type":46,"tag":304,"props":1684,"children":1685},{},[1686],{"type":51,"value":1551},{"type":46,"tag":304,"props":1688,"children":1689},{"class":306,"line":343},[1690],{"type":46,"tag":304,"props":1691,"children":1692},{},[1693],{"type":51,"value":1694},"ckpt.load(\"ckpt_{seq:04d}.json\")     # picks the highest sequence number\n",{"type":46,"tag":304,"props":1696,"children":1697},{"class":306,"line":352},[1698],{"type":46,"tag":304,"props":1699,"children":1700},{},[1701],{"type":51,"value":1702},"ckpt.register(reader, \"my_reader\")   # state applied here\n",{"type":46,"tag":304,"props":1704,"children":1705},{"class":306,"line":361},[1706],{"type":46,"tag":304,"props":1707,"children":1708},{},[1709],{"type":51,"value":1710},"ckpt.register(rng, \"rng\")            # ditto\n",{"type":46,"tag":304,"props":1712,"children":1713},{"class":306,"line":1600},[1714],{"type":46,"tag":304,"props":1715,"children":1716},{"emptyLinePlaceholder":884},[1717],{"type":51,"value":887},{"type":46,"tag":304,"props":1719,"children":1721},{"class":306,"line":1720},9,[1722],{"type":46,"tag":304,"props":1723,"children":1724},{},[1725],{"type":51,"value":1726},"for batch in reader.next_epoch(batch_size=N):\n",{"type":46,"tag":304,"props":1728,"children":1730},{"class":306,"line":1729},10,[1731],{"type":46,"tag":304,"props":1732,"children":1733},{},[1734],{"type":51,"value":1735},"    ...  # produces the next batch after the checkpointed iteration\n",{"type":46,"tag":61,"props":1737,"children":1738},{},[1739],{"type":51,"value":1740},"Key rules:",{"type":46,"tag":89,"props":1742,"children":1743},{},[1744,1777,1816,1853,1893,1931,1985,2002],{"type":46,"tag":93,"props":1745,"children":1746},{},[1747,1752,1754,1760,1762,1768,1770,1775],{"type":46,"tag":428,"props":1748,"children":1749},{},[1750],{"type":51,"value":1751},"Readers must opt in.",{"type":51,"value":1753}," Construct with ",{"type":46,"tag":67,"props":1755,"children":1757},{"className":1756},[],[1758],{"type":51,"value":1759},"enable_checkpointing=True",{"type":51,"value":1761},". Registering an already-iterated reader without it raises ",{"type":46,"tag":67,"props":1763,"children":1765},{"className":1764},[],[1766],{"type":51,"value":1767},"RuntimeError",{"type":51,"value":1769},"; if the reader has not been iterated yet, ",{"type":46,"tag":67,"props":1771,"children":1773},{"className":1772},[],[1774],{"type":51,"value":1640},{"type":51,"value":1776}," enables it retroactively.",{"type":46,"tag":93,"props":1778,"children":1779},{},[1780,1793,1795,1801,1803,1808,1810,1815],{"type":46,"tag":428,"props":1781,"children":1782},{},[1783,1785,1791],{"type":51,"value":1784},"Reader state must be applied before the first ",{"type":46,"tag":67,"props":1786,"children":1788},{"className":1787},[],[1789],{"type":51,"value":1790},"next_epoch",{"type":51,"value":1792}," call.",{"type":51,"value":1794}," The prefetch thread starts on first iteration and the snapshot queue is locked after that. ",{"type":46,"tag":67,"props":1796,"children":1798},{"className":1797},[],[1799],{"type":51,"value":1800},"set_state",{"type":51,"value":1802}," (or a ",{"type":46,"tag":67,"props":1804,"children":1806},{"className":1805},[],[1807],{"type":51,"value":1640},{"type":51,"value":1809}," from a loaded checkpoint) on an already-iterated reader raises ",{"type":46,"tag":67,"props":1811,"children":1813},{"className":1812},[],[1814],{"type":51,"value":1767},{"type":51,"value":143},{"type":46,"tag":93,"props":1817,"children":1818},{},[1819,1836,1838,1844,1846,1852],{"type":46,"tag":428,"props":1820,"children":1821},{},[1822,1827,1829,1835],{"type":46,"tag":67,"props":1823,"children":1825},{"className":1824},[],[1826],{"type":51,"value":1759},{"type":51,"value":1828}," is incompatible with ",{"type":46,"tag":67,"props":1830,"children":1832},{"className":1831},[],[1833],{"type":51,"value":1834},"compile=True",{"type":51,"value":143},{"type":51,"value":1837}," Calling ",{"type":46,"tag":67,"props":1839,"children":1841},{"className":1840},[],[1842],{"type":51,"value":1843},"reader.next_epoch(..., compile=True)",{"type":51,"value":1845}," on a checkpointing-enabled reader raises ",{"type":46,"tag":67,"props":1847,"children":1849},{"className":1848},[],[1850],{"type":51,"value":1851},"NotImplementedError",{"type":51,"value":143},{"type":46,"tag":93,"props":1854,"children":1855},{},[1856,1861,1863,1869,1871,1877,1878,1884,1886,1892],{"type":46,"tag":428,"props":1857,"children":1858},{},[1859],{"type":51,"value":1860},"Named registration is safer.",{"type":51,"value":1862}," Anonymous ",{"type":46,"tag":67,"props":1864,"children":1866},{"className":1865},[],[1867],{"type":51,"value":1868},"register(op)",{"type":51,"value":1870}," uses sequential keys (",{"type":46,"tag":67,"props":1872,"children":1874},{"className":1873},[],[1875],{"type":51,"value":1876},"__op_0",{"type":51,"value":120},{"type":46,"tag":67,"props":1879,"children":1881},{"className":1880},[],[1882],{"type":51,"value":1883},"__op_1",{"type":51,"value":1885},", ...) so the registration order must match between save and restore. Type tags catch cross-type swaps but not reorders of compatible types. Prefer ",{"type":46,"tag":67,"props":1887,"children":1889},{"className":1888},[],[1890],{"type":51,"value":1891},"register(op, name)",{"type":51,"value":143},{"type":46,"tag":93,"props":1894,"children":1895},{},[1896,1905,1907,1913,1915,1921,1923,1929],{"type":46,"tag":428,"props":1897,"children":1898},{},[1899],{"type":46,"tag":67,"props":1900,"children":1902},{"className":1901},[],[1903],{"type":51,"value":1904},"ndd.checkpoint.current()",{"type":51,"value":1906}," returns the ",{"type":46,"tag":67,"props":1908,"children":1910},{"className":1909},[],[1911],{"type":51,"value":1912},"Checkpoint",{"type":51,"value":1914}," bound to the current thread-local ",{"type":46,"tag":67,"props":1916,"children":1918},{"className":1917},[],[1919],{"type":51,"value":1920},"EvalContext",{"type":51,"value":1922},". It's shared across calls -- call ",{"type":46,"tag":67,"props":1924,"children":1926},{"className":1925},[],[1927],{"type":51,"value":1928},"ckpt.clear()",{"type":51,"value":1930}," if reusing the default context for unrelated runs.",{"type":46,"tag":93,"props":1932,"children":1933},{},[1934,1939,1940,1946,1948,1953,1955,1961,1963,1969,1971,1976,1978,1983],{"type":46,"tag":428,"props":1935,"children":1936},{},[1937],{"type":51,"value":1938},"Filename pattern:",{"type":51,"value":837},{"type":46,"tag":67,"props":1941,"children":1943},{"className":1942},[],[1944],{"type":51,"value":1945},"save",{"type":51,"value":1947},"\u002F",{"type":46,"tag":67,"props":1949,"children":1951},{"className":1950},[],[1952],{"type":51,"value":1632},{"type":51,"value":1954}," take a Python format string with a single ",{"type":46,"tag":67,"props":1956,"children":1958},{"className":1957},[],[1959],{"type":51,"value":1960},"{seq}",{"type":51,"value":1962}," placeholder (e.g. ",{"type":46,"tag":67,"props":1964,"children":1966},{"className":1965},[],[1967],{"type":51,"value":1968},"\"ckpt_{seq:04d}.json\"",{"type":51,"value":1970},"). ",{"type":46,"tag":67,"props":1972,"children":1974},{"className":1973},[],[1975],{"type":51,"value":1945},{"type":51,"value":1977}," picks the next free sequence; ",{"type":46,"tag":67,"props":1979,"children":1981},{"className":1980},[],[1982],{"type":51,"value":1632},{"type":51,"value":1984}," picks the highest matching one on disk.",{"type":46,"tag":93,"props":1986,"children":1987},{},[1988,1993,1994,2000],{"type":46,"tag":428,"props":1989,"children":1990},{},[1991],{"type":51,"value":1992},"Format version is strict.",{"type":51,"value":837},{"type":46,"tag":67,"props":1995,"children":1997},{"className":1996},[],[1998],{"type":51,"value":1999},"deserialize",{"type":51,"value":2001}," rejects payloads from a different checkpoint format version -- no automatic upgrade.",{"type":46,"tag":93,"props":2003,"children":2004},{},[2005,2010,2012,2017],{"type":46,"tag":428,"props":2006,"children":2007},{},[2008],{"type":51,"value":2009},"Not thread-safe.",{"type":51,"value":2011}," One ",{"type":46,"tag":67,"props":2013,"children":2015},{"className":2014},[],[2016],{"type":51,"value":1912},{"type":51,"value":2018}," per thread.",{"type":46,"tag":61,"props":2020,"children":2021},{},[2022,2024,2030,2032,2037,2039,2045,2047,2052,2054,2059],{"type":51,"value":2023},"Manual ",{"type":46,"tag":67,"props":2025,"children":2027},{"className":2026},[],[2028],{"type":51,"value":2029},"get_state",{"type":51,"value":2031}," \u002F ",{"type":46,"tag":67,"props":2033,"children":2035},{"className":2034},[],[2036],{"type":51,"value":1800},{"type":51,"value":2038}," is also available directly on each ",{"type":46,"tag":67,"props":2040,"children":2042},{"className":2041},[],[2043],{"type":51,"value":2044},"Reader",{"type":51,"value":2046}," and ",{"type":46,"tag":67,"props":2048,"children":2050},{"className":2049},[],[2051],{"type":51,"value":1419},{"type":51,"value":2053}," -- the ",{"type":46,"tag":67,"props":2055,"children":2057},{"className":2056},[],[2058],{"type":51,"value":1912},{"type":51,"value":2060}," aggregator is built on top of it. Use the manual API only when integrating with an external checkpoint system.",{"type":46,"tag":54,"props":2062,"children":2064},{"id":2063},"examples",[2065],{"type":51,"value":2066},"Examples",{"type":46,"tag":287,"props":2068,"children":2070},{"id":2069},"image-classification-pipeline",[2071],{"type":51,"value":2072},"Image Classification Pipeline",{"type":46,"tag":294,"props":2074,"children":2076},{"className":296,"code":2075,"language":40,"meta":298,"style":298},"import nvidia.dali.experimental.dynamic as ndd\n\nreader = ndd.readers.File(file_root=\"\u002Fdata\u002Fimagenet\u002Ftrain\", random_shuffle=True)\n\nfor epoch in range(num_epochs):\n    for jpegs, labels in reader.next_epoch(batch_size=64):\n        images = ndd.decoders.image(jpegs, device=\"gpu\")\n        images = ndd.resize(images, size=[224, 224])\n        images = ndd.crop_mirror_normalize(\n            images,\n            mean=[0.485 * 255, 0.456 * 255, 0.406 * 255],\n            std=[0.229 * 255, 0.224 * 255, 0.225 * 255],\n        )\n        train_step(images.torch(), labels.torch())\n",[2077],{"type":46,"tag":67,"props":2078,"children":2079},{"__ignoreMap":298},[2080,2088,2095,2103,2110,2117,2124,2132,2140,2148,2156,2165,2174,2183],{"type":46,"tag":304,"props":2081,"children":2082},{"class":306,"line":307},[2083],{"type":46,"tag":304,"props":2084,"children":2085},{},[2086],{"type":51,"value":2087},"import nvidia.dali.experimental.dynamic as ndd\n",{"type":46,"tag":304,"props":2089,"children":2090},{"class":306,"line":316},[2091],{"type":46,"tag":304,"props":2092,"children":2093},{"emptyLinePlaceholder":884},[2094],{"type":51,"value":887},{"type":46,"tag":304,"props":2096,"children":2097},{"class":306,"line":325},[2098],{"type":46,"tag":304,"props":2099,"children":2100},{},[2101],{"type":51,"value":2102},"reader = ndd.readers.File(file_root=\"\u002Fdata\u002Fimagenet\u002Ftrain\", random_shuffle=True)\n",{"type":46,"tag":304,"props":2104,"children":2105},{"class":306,"line":334},[2106],{"type":46,"tag":304,"props":2107,"children":2108},{"emptyLinePlaceholder":884},[2109],{"type":51,"value":887},{"type":46,"tag":304,"props":2111,"children":2112},{"class":306,"line":343},[2113],{"type":46,"tag":304,"props":2114,"children":2115},{},[2116],{"type":51,"value":895},{"type":46,"tag":304,"props":2118,"children":2119},{"class":306,"line":352},[2120],{"type":46,"tag":304,"props":2121,"children":2122},{},[2123],{"type":51,"value":903},{"type":46,"tag":304,"props":2125,"children":2126},{"class":306,"line":361},[2127],{"type":46,"tag":304,"props":2128,"children":2129},{},[2130],{"type":51,"value":2131},"        images = ndd.decoders.image(jpegs, device=\"gpu\")\n",{"type":46,"tag":304,"props":2133,"children":2134},{"class":306,"line":1600},[2135],{"type":46,"tag":304,"props":2136,"children":2137},{},[2138],{"type":51,"value":2139},"        images = ndd.resize(images, size=[224, 224])\n",{"type":46,"tag":304,"props":2141,"children":2142},{"class":306,"line":1720},[2143],{"type":46,"tag":304,"props":2144,"children":2145},{},[2146],{"type":51,"value":2147},"        images = ndd.crop_mirror_normalize(\n",{"type":46,"tag":304,"props":2149,"children":2150},{"class":306,"line":1729},[2151],{"type":46,"tag":304,"props":2152,"children":2153},{},[2154],{"type":51,"value":2155},"            images,\n",{"type":46,"tag":304,"props":2157,"children":2159},{"class":306,"line":2158},11,[2160],{"type":46,"tag":304,"props":2161,"children":2162},{},[2163],{"type":51,"value":2164},"            mean=[0.485 * 255, 0.456 * 255, 0.406 * 255],\n",{"type":46,"tag":304,"props":2166,"children":2168},{"class":306,"line":2167},12,[2169],{"type":46,"tag":304,"props":2170,"children":2171},{},[2172],{"type":51,"value":2173},"            std=[0.229 * 255, 0.224 * 255, 0.225 * 255],\n",{"type":46,"tag":304,"props":2175,"children":2177},{"class":306,"line":2176},13,[2178],{"type":46,"tag":304,"props":2179,"children":2180},{},[2181],{"type":51,"value":2182},"        )\n",{"type":46,"tag":304,"props":2184,"children":2186},{"class":306,"line":2185},14,[2187],{"type":46,"tag":304,"props":2188,"children":2189},{},[2190],{"type":51,"value":2191},"        train_step(images.torch(), labels.torch())\n",{"type":46,"tag":54,"props":2193,"children":2195},{"id":2194},"common-mistakes",[2196],{"type":51,"value":2197},"Common Mistakes",{"type":46,"tag":458,"props":2199,"children":2200},{},[2201,2222],{"type":46,"tag":462,"props":2202,"children":2203},{},[2204],{"type":46,"tag":466,"props":2205,"children":2206},{},[2207,2212,2217],{"type":46,"tag":470,"props":2208,"children":2209},{},[2210],{"type":51,"value":2211},"Wrong",{"type":46,"tag":470,"props":2213,"children":2214},{},[2215],{"type":51,"value":2216},"Right",{"type":46,"tag":470,"props":2218,"children":2219},{},[2220],{"type":51,"value":2221},"Why",{"type":46,"tag":486,"props":2223,"children":2224},{},[2225,2255,2289,2330,2364,2392,2414,2439,2475,2503,2534,2566],{"type":46,"tag":466,"props":2226,"children":2227},{},[2228,2237,2245],{"type":46,"tag":493,"props":2229,"children":2230},{},[2231],{"type":46,"tag":67,"props":2232,"children":2234},{"className":2233},[],[2235],{"type":51,"value":2236},"device=\"mixed\"",{"type":46,"tag":493,"props":2238,"children":2239},{},[2240],{"type":46,"tag":67,"props":2241,"children":2243},{"className":2242},[],[2244],{"type":51,"value":186},{"type":46,"tag":493,"props":2246,"children":2247},{},[2248,2253],{"type":46,"tag":67,"props":2249,"children":2251},{"className":2250},[],[2252],{"type":51,"value":194},{"type":51,"value":2254}," is pipeline mode only",{"type":46,"tag":466,"props":2256,"children":2257},{},[2258,2266,2274],{"type":46,"tag":493,"props":2259,"children":2260},{},[2261],{"type":46,"tag":67,"props":2262,"children":2264},{"className":2263},[],[2265],{"type":51,"value":446},{"type":46,"tag":493,"props":2267,"children":2268},{},[2269],{"type":46,"tag":67,"props":2270,"children":2272},{"className":2271},[],[2273],{"type":51,"value":506},{"type":46,"tag":493,"props":2275,"children":2276},{},[2277,2282,2284],{"type":46,"tag":67,"props":2278,"children":2280},{"className":2279},[],[2281],{"type":51,"value":541},{"type":51,"value":2283}," has no ",{"type":46,"tag":67,"props":2285,"children":2287},{"className":2286},[],[2288],{"type":51,"value":438},{"type":46,"tag":466,"props":2290,"children":2291},{},[2292,2303,2312],{"type":46,"tag":493,"props":2293,"children":2294},{},[2295,2301],{"type":46,"tag":67,"props":2296,"children":2298},{"className":2297},[],[2299],{"type":51,"value":2300},"batch.tensors[0]",{"type":51,"value":2302}," for per-sample slicing",{"type":46,"tag":493,"props":2304,"children":2305},{},[2306],{"type":46,"tag":67,"props":2307,"children":2309},{"className":2308},[],[2310],{"type":51,"value":2311},"batch.slice[0]",{"type":46,"tag":493,"props":2313,"children":2314},{},[2315,2321,2323,2328],{"type":46,"tag":67,"props":2316,"children":2318},{"className":2317},[],[2319],{"type":51,"value":2320},".tensors",{"type":51,"value":2322}," pick samples; ",{"type":46,"tag":67,"props":2324,"children":2326},{"className":2325},[],[2327],{"type":51,"value":618},{"type":51,"value":2329}," slices within each sample",{"type":46,"tag":466,"props":2331,"children":2332},{},[2333,2343,2348],{"type":46,"tag":493,"props":2334,"children":2335},{},[2336,2341],{"type":46,"tag":67,"props":2337,"children":2339},{"className":2338},[],[2340],{"type":51,"value":1242},{"type":51,"value":2342}," after every op",{"type":46,"tag":493,"props":2344,"children":2345},{},[2346],{"type":51,"value":2347},"Let consumption trigger eval",{"type":46,"tag":493,"props":2349,"children":2350},{},[2351,2356,2357,2362],{"type":46,"tag":67,"props":2352,"children":2354},{"className":2353},[],[2355],{"type":51,"value":222},{"type":51,"value":120},{"type":46,"tag":67,"props":2358,"children":2360},{"className":2359},[],[2361],{"type":51,"value":1270},{"type":51,"value":2363},", etc. trigger it automatically",{"type":46,"tag":466,"props":2365,"children":2366},{},[2367,2377,2387],{"type":46,"tag":493,"props":2368,"children":2369},{},[2370,2375],{"type":46,"tag":67,"props":2371,"children":2373},{"className":2372},[],[2374],{"type":51,"value":1175},{"type":51,"value":2376}," before GPU model",{"type":46,"tag":493,"props":2378,"children":2379},{},[2380,2385],{"type":46,"tag":67,"props":2381,"children":2383},{"className":2382},[],[2384],{"type":51,"value":222},{"type":51,"value":2386}," directly",{"type":46,"tag":493,"props":2388,"children":2389},{},[2390],{"type":51,"value":2391},"Avoids wasteful D2H + H2D round-trip",{"type":46,"tag":466,"props":2393,"children":2394},{},[2395,2400,2409],{"type":46,"tag":493,"props":2396,"children":2397},{},[2398],{"type":51,"value":2399},"Recreate reader each epoch",{"type":46,"tag":493,"props":2401,"children":2402},{},[2403],{"type":46,"tag":67,"props":2404,"children":2406},{"className":2405},[],[2407],{"type":51,"value":2408},"reader.next_epoch()",{"type":46,"tag":493,"props":2410,"children":2411},{},[2412],{"type":51,"value":2413},"Readers are stateful -- create once, reuse",{"type":46,"tag":466,"props":2415,"children":2416},{},[2417,2426,2434],{"type":46,"tag":493,"props":2418,"children":2419},{},[2420],{"type":46,"tag":67,"props":2421,"children":2423},{"className":2422},[],[2424],{"type":51,"value":2425},"ndd.readers.file(...)",{"type":46,"tag":493,"props":2427,"children":2428},{},[2429],{"type":46,"tag":67,"props":2430,"children":2432},{"className":2431},[],[2433],{"type":51,"value":964},{"type":46,"tag":493,"props":2435,"children":2436},{},[2437],{"type":51,"value":2438},"Reader classes are PascalCase",{"type":46,"tag":466,"props":2440,"children":2441},{},[2442,2460,2465],{"type":46,"tag":493,"props":2443,"children":2444},{},[2445,2451,2453,2458],{"type":46,"tag":67,"props":2446,"children":2448},{"className":2447},[],[2449],{"type":51,"value":2450},"break",{"type":51,"value":2452}," from ",{"type":46,"tag":67,"props":2454,"children":2456},{"className":2455},[],[2457],{"type":51,"value":994},{"type":51,"value":2459}," loop",{"type":46,"tag":493,"props":2461,"children":2462},{},[2463],{"type":51,"value":2464},"Exhaust iterator or create new reader",{"type":46,"tag":493,"props":2466,"children":2467},{},[2468,2470],{"type":51,"value":2469},"Iterator must be fully consumed before next ",{"type":46,"tag":67,"props":2471,"children":2473},{"className":2472},[],[2474],{"type":51,"value":994},{"type":46,"tag":466,"props":2476,"children":2477},{},[2478,2489,2498],{"type":46,"tag":493,"props":2479,"children":2480},{},[2481,2482,2487],{"type":51,"value":1236},{"type":46,"tag":67,"props":2483,"children":2485},{"className":2484},[],[2486],{"type":51,"value":154},{"type":51,"value":2488}," to random ops",{"type":46,"tag":493,"props":2490,"children":2491},{},[2492],{"type":46,"tag":67,"props":2493,"children":2495},{"className":2494},[],[2496],{"type":51,"value":2497},"ndd.random.uniform(batch_size=N, ...)",{"type":46,"tag":493,"props":2499,"children":2500},{},[2501],{"type":51,"value":2502},"No pipeline-level batch size to inherit",{"type":46,"tag":466,"props":2504,"children":2505},{},[2506,2524,2529],{"type":46,"tag":493,"props":2507,"children":2508},{},[2509,2515,2517,2522],{"type":46,"tag":67,"props":2510,"children":2512},{"className":2511},[],[2513],{"type":51,"value":2514},"register(reader)",{"type":51,"value":2516}," after first ",{"type":46,"tag":67,"props":2518,"children":2520},{"className":2519},[],[2521],{"type":51,"value":1790},{"type":51,"value":2523}," to restore",{"type":46,"tag":493,"props":2525,"children":2526},{},[2527],{"type":51,"value":2528},"Register the freshly built reader before the first iteration",{"type":46,"tag":493,"props":2530,"children":2531},{},[2532],{"type":51,"value":2533},"Reader state can only be applied before the prefetch thread starts",{"type":46,"tag":466,"props":2535,"children":2536},{},[2537,2549,2561],{"type":46,"tag":493,"props":2538,"children":2539},{},[2540,2542,2547],{"type":51,"value":2541},"Restoring into a reader built without ",{"type":46,"tag":67,"props":2543,"children":2545},{"className":2544},[],[2546],{"type":51,"value":1759},{"type":51,"value":2548}," after iteration",{"type":46,"tag":493,"props":2550,"children":2551},{},[2552,2554,2559],{"type":51,"value":2553},"Pass ",{"type":46,"tag":67,"props":2555,"children":2557},{"className":2556},[],[2558],{"type":51,"value":1759},{"type":51,"value":2560}," at construction (or register before first iteration)",{"type":46,"tag":493,"props":2562,"children":2563},{},[2564],{"type":51,"value":2565},"Backend doesn't keep snapshots otherwise",{"type":46,"tag":466,"props":2567,"children":2568},{},[2569,2574,2579],{"type":46,"tag":493,"props":2570,"children":2571},{},[2572],{"type":51,"value":2573},"Spelling out default argument values",{"type":46,"tag":493,"props":2575,"children":2576},{},[2577],{"type":51,"value":2578},"Skip default argument values",{"type":46,"tag":493,"props":2580,"children":2581},{},[2582],{"type":51,"value":2583},"Very high Python-side overhead, especially when the argument accepts Tensors\u002FBatches. Skipping arguments uses a fast path, actually passing a sentinel value.",{"type":46,"tag":54,"props":2585,"children":2587},{"id":2586},"pipeline-mode-migration",[2588],{"type":51,"value":2589},"Pipeline Mode Migration",{"type":46,"tag":458,"props":2591,"children":2592},{},[2593,2609],{"type":46,"tag":462,"props":2594,"children":2595},{},[2596],{"type":46,"tag":466,"props":2597,"children":2598},{},[2599,2604],{"type":46,"tag":470,"props":2600,"children":2601},{},[2602],{"type":51,"value":2603},"Pipeline Mode",{"type":46,"tag":470,"props":2605,"children":2606},{},[2607],{"type":51,"value":2608},"Dynamic Mode",{"type":46,"tag":486,"props":2610,"children":2611},{},[2612,2640,2662,2683,2704,2734,2764,2788,2808,2829,2863],{"type":46,"tag":466,"props":2613,"children":2614},{},[2615,2635],{"type":46,"tag":493,"props":2616,"children":2617},{},[2618,2623,2624,2629,2630],{"type":46,"tag":67,"props":2619,"children":2621},{"className":2620},[],[2622],{"type":51,"value":126},{"type":51,"value":2031},{"type":46,"tag":67,"props":2625,"children":2627},{"className":2626},[],[2628],{"type":51,"value":133},{"type":51,"value":2031},{"type":46,"tag":67,"props":2631,"children":2633},{"className":2632},[],[2634],{"type":51,"value":141},{"type":46,"tag":493,"props":2636,"children":2637},{},[2638],{"type":51,"value":2639},"Direct function calls in a loop",{"type":46,"tag":466,"props":2641,"children":2642},{},[2643,2652],{"type":46,"tag":493,"props":2644,"children":2645},{},[2646],{"type":46,"tag":67,"props":2647,"children":2649},{"className":2648},[],[2650],{"type":51,"value":2651},"fn.readers.file(...)",{"type":46,"tag":493,"props":2653,"children":2654},{},[2655,2660],{"type":46,"tag":67,"props":2656,"children":2658},{"className":2657},[],[2659],{"type":51,"value":964},{"type":51,"value":2661}," (PascalCase, stateful)",{"type":46,"tag":466,"props":2663,"children":2664},{},[2665,2674],{"type":46,"tag":493,"props":2666,"children":2667},{},[2668],{"type":46,"tag":67,"props":2669,"children":2671},{"className":2670},[],[2672],{"type":51,"value":2673},"fn.decoders.image(jpegs, device=\"mixed\")",{"type":46,"tag":493,"props":2675,"children":2676},{},[2677],{"type":46,"tag":67,"props":2678,"children":2680},{"className":2679},[],[2681],{"type":51,"value":2682},"ndd.decoders.image(jpegs, device=\"gpu\")",{"type":46,"tag":466,"props":2684,"children":2685},{},[2686,2695],{"type":46,"tag":493,"props":2687,"children":2688},{},[2689],{"type":46,"tag":67,"props":2690,"children":2692},{"className":2691},[],[2693],{"type":51,"value":2694},"fn.op_name(...)",{"type":46,"tag":493,"props":2696,"children":2697},{},[2698],{"type":46,"tag":67,"props":2699,"children":2701},{"className":2700},[],[2702],{"type":51,"value":2703},"ndd.op_name(...)",{"type":46,"tag":466,"props":2705,"children":2706},{},[2707,2718],{"type":46,"tag":493,"props":2708,"children":2709},{},[2710,2712],{"type":51,"value":2711},"Pipeline-level ",{"type":46,"tag":67,"props":2713,"children":2715},{"className":2714},[],[2716],{"type":51,"value":2717},"batch_size=64",{"type":46,"tag":493,"props":2719,"children":2720},{},[2721,2727,2729],{"type":46,"tag":67,"props":2722,"children":2724},{"className":2723},[],[2725],{"type":51,"value":2726},"reader.next_epoch(batch_size=64)",{"type":51,"value":2728}," + random ops ",{"type":46,"tag":67,"props":2730,"children":2732},{"className":2731},[],[2733],{"type":51,"value":2717},{"type":46,"tag":466,"props":2735,"children":2736},{},[2737,2747],{"type":46,"tag":493,"props":2738,"children":2739},{},[2740,2741],{"type":51,"value":2711},{"type":46,"tag":67,"props":2742,"children":2744},{"className":2743},[],[2745],{"type":51,"value":2746},"seed=42",{"type":46,"tag":493,"props":2748,"children":2749},{},[2750,2756,2758],{"type":46,"tag":67,"props":2751,"children":2753},{"className":2752},[],[2754],{"type":51,"value":2755},"ndd.random.set_seed(42)",{"type":51,"value":2757}," or ",{"type":46,"tag":67,"props":2759,"children":2761},{"className":2760},[],[2762],{"type":51,"value":2763},"ndd.random.RNG(seed=42)",{"type":46,"tag":466,"props":2765,"children":2766},{},[2767,2777],{"type":46,"tag":493,"props":2768,"children":2769},{},[2770,2771],{"type":51,"value":2711},{"type":46,"tag":67,"props":2772,"children":2774},{"className":2773},[],[2775],{"type":51,"value":2776},"num_threads=4",{"type":46,"tag":493,"props":2778,"children":2779},{},[2780,2786],{"type":46,"tag":67,"props":2781,"children":2783},{"className":2782},[],[2784],{"type":51,"value":2785},"ndd.set_num_threads(4)",{"type":51,"value":2787}," at startup",{"type":46,"tag":466,"props":2789,"children":2790},{},[2791,2800],{"type":46,"tag":493,"props":2792,"children":2793},{},[2794],{"type":46,"tag":67,"props":2795,"children":2797},{"className":2796},[],[2798],{"type":51,"value":2799},"output.at(i)",{"type":46,"tag":493,"props":2801,"children":2802},{},[2803],{"type":46,"tag":67,"props":2804,"children":2806},{"className":2805},[],[2807],{"type":51,"value":506},{"type":46,"tag":466,"props":2809,"children":2810},{},[2811,2820],{"type":46,"tag":493,"props":2812,"children":2813},{},[2814],{"type":46,"tag":67,"props":2815,"children":2817},{"className":2816},[],[2818],{"type":51,"value":2819},"output.as_cpu()",{"type":46,"tag":493,"props":2821,"children":2822},{},[2823],{"type":46,"tag":67,"props":2824,"children":2826},{"className":2825},[],[2827],{"type":51,"value":2828},"batch.cpu()",{"type":46,"tag":466,"props":2830,"children":2831},{},[2832,2848],{"type":46,"tag":493,"props":2833,"children":2834},{},[2835,2840,2842],{"type":46,"tag":67,"props":2836,"children":2838},{"className":2837},[],[2839],{"type":51,"value":141},{"type":51,"value":2841}," returns tuple of ",{"type":46,"tag":67,"props":2843,"children":2845},{"className":2844},[],[2846],{"type":51,"value":2847},"TensorList",{"type":46,"tag":493,"props":2849,"children":2850},{},[2851,2857,2858],{"type":46,"tag":67,"props":2852,"children":2854},{"className":2853},[],[2855],{"type":51,"value":2856},"reader.next_epoch(batch_size=N)",{"type":51,"value":1007},{"type":46,"tag":67,"props":2859,"children":2861},{"className":2860},[],[2862],{"type":51,"value":541},{"type":46,"tag":466,"props":2864,"children":2865},{},[2866,2889],{"type":46,"tag":493,"props":2867,"children":2868},{},[2869,2875,2876,2882,2883],{"type":46,"tag":67,"props":2870,"children":2872},{"className":2871},[],[2873],{"type":51,"value":2874},"Pipeline(..., enable_checkpointing=True)",{"type":51,"value":1634},{"type":46,"tag":67,"props":2877,"children":2879},{"className":2878},[],[2880],{"type":51,"value":2881},"pipe.checkpoint()",{"type":51,"value":2031},{"type":46,"tag":67,"props":2884,"children":2886},{"className":2885},[],[2887],{"type":51,"value":2888},"pipeline(checkpoint=...)",{"type":46,"tag":493,"props":2890,"children":2891},{},[2892,2898,2900,2905,2906,2912,2913,2918,2919,2924,2926],{"type":46,"tag":67,"props":2893,"children":2895},{"className":2894},[],[2896],{"type":51,"value":2897},"ndd.checkpoint.Checkpoint",{"type":51,"value":2899}," + per-object ",{"type":46,"tag":67,"props":2901,"children":2903},{"className":2902},[],[2904],{"type":51,"value":1640},{"type":51,"value":2031},{"type":46,"tag":67,"props":2907,"children":2909},{"className":2908},[],[2910],{"type":51,"value":2911},"collect",{"type":51,"value":2031},{"type":46,"tag":67,"props":2914,"children":2916},{"className":2915},[],[2917],{"type":51,"value":1945},{"type":51,"value":2031},{"type":46,"tag":67,"props":2920,"children":2922},{"className":2921},[],[2923],{"type":51,"value":1632},{"type":51,"value":2925},"; readers opt in with ",{"type":46,"tag":67,"props":2927,"children":2929},{"className":2928},[],[2930],{"type":51,"value":1759},{"type":46,"tag":54,"props":2932,"children":2934},{"id":2933},"limitations",[2935],{"type":51,"value":2936},"Limitations",{"type":46,"tag":61,"props":2938,"children":2939},{},[2940],{"type":51,"value":2941},"Dynamic mode is more flexible than pipeline mode, but can have slightly worse performance. For maximum throughput, prefer pipeline mode.",{"type":46,"tag":54,"props":2943,"children":2945},{"id":2944},"troubleshooting",[2946],{"type":51,"value":2947},"Troubleshooting",{"type":46,"tag":89,"props":2949,"children":2950},{},[2951,2969],{"type":46,"tag":93,"props":2952,"children":2953},{},[2954,2956,2962,2963,2968],{"type":51,"value":2955},"If errors surface later than the failing call, rerun the block under ",{"type":46,"tag":67,"props":2957,"children":2959},{"className":2958},[],[2960],{"type":51,"value":2961},"EvalMode.sync_cpu",{"type":51,"value":2757},{"type":46,"tag":67,"props":2964,"children":2966},{"className":2965},[],[2967],{"type":51,"value":1358},{"type":51,"value":143},{"type":46,"tag":93,"props":2970,"children":2971},{},[2972,2974,2979],{"type":51,"value":2973},"If a reader behaves unexpectedly across epochs, check that it is created once and each ",{"type":46,"tag":67,"props":2975,"children":2977},{"className":2976},[],[2978],{"type":51,"value":994},{"type":51,"value":2980}," iterator is fully consumed.",{"type":46,"tag":2982,"props":2983,"children":2984},"style",{},[2985],{"type":51,"value":2986},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"items":2988,"total":3146},[2989,3007,3024,3035,3047,3061,3074,3088,3101,3112,3126,3135],{"slug":2990,"name":2990,"fn":2991,"description":2992,"org":2993,"tags":2994,"stars":3004,"repoUrl":3005,"updatedAt":3006},"nemoclaw-user-guide","retrieve NemoClaw documentation and configuration","Guides human users' AI agents to the NemoClaw docs MCP server and canonical Fern documentation in Markdown form. Use when users ask how to install, configure, operate, troubleshoot, secure, or learn NemoClaw with an AI coding assistant. Trigger keywords - nemoclaw docs, use nemoclaw with ai agent, nemoclaw mcp docs, nemoclaw install help, nemoclaw quickstart, nemoclaw markdown docs, llms.txt, agent skills.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2995,2998,3001],{"name":2996,"slug":2997,"type":15},"Documentation","documentation",{"name":2999,"slug":3000,"type":15},"MCP","mcp",{"name":3002,"slug":3003,"type":15},"Search","search",21777,"https:\u002F\u002Fgithub.com\u002FNVIDIA\u002FNemoClaw","2026-07-20T06:00:01.461044",{"slug":3008,"name":3008,"fn":3009,"description":3010,"org":3011,"tags":3012,"stars":3021,"repoUrl":3022,"updatedAt":3023},"mcore-build-and-dependency","manage Megatron-LM development environments","Container-based dev environment setup and dependency management for Megatron-LM. Covers acquiring and launching the CI container, uv package management, and updating uv.lock.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[3013,3016,3019],{"name":3014,"slug":3015,"type":15},"Containers","containers",{"name":3017,"slug":3018,"type":15},"Deployment","deployment",{"name":3020,"slug":40,"type":15},"Python",17049,"https:\u002F\u002Fgithub.com\u002FNVIDIA\u002FMegatron-LM","2026-07-27T06:06:11.249662",{"slug":3025,"name":3025,"fn":3026,"description":3027,"org":3028,"tags":3029,"stars":3021,"repoUrl":3022,"updatedAt":3034},"mcore-bump-base-image","update NVIDIA PyTorch base images","Bump the NVIDIA PyTorch base image (`nvcr.io\u002Fnvidia\u002Fpytorch:YY.MM-py3`) used by Megatron-LM CI. Covers the two pin sites (GitHub CI in `docker\u002F.ngc_version.dev` and GitLab CI in `.gitlab\u002Fstages\u002F01.build.yml`), the post-bump CI loop (re-run functional tests, refresh golden values, mark broken tests), and the gotchas that bit PRs",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[3030,3033],{"name":3031,"slug":3032,"type":15},"CI\u002FCD","ci-cd",{"name":3017,"slug":3018,"type":15},"2026-07-14T05:25:59.97109",{"slug":3036,"name":3036,"fn":3037,"description":3038,"org":3039,"tags":3040,"stars":3021,"repoUrl":3022,"updatedAt":3046},"mcore-cicd","manage CI\u002FCD pipelines for Megatron-LM","CI\u002FCD reference for Megatron-LM. Covers CI pipeline structure, PR scope labels, triggering internal GitLab CI (which force-pushes the current branch to a pull-request\u002FBRANCH ref — always dry-run and verify the destination first; never run against shared or protected branches), and CI failure investigation.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[3041,3042,3043],{"name":3031,"slug":3032,"type":15},{"name":3017,"slug":3018,"type":15},{"name":3044,"slug":3045,"type":15},"GitHub","github","2026-07-27T06:06:12.278222",{"slug":3048,"name":3048,"fn":3049,"description":3050,"org":3051,"tags":3052,"stars":3021,"repoUrl":3022,"updatedAt":3060},"mcore-create-issue","investigate CI failures and create issues","Investigate a failing GitHub Actions run or job and create a GitHub issue for the failure.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[3053,3056,3057],{"name":3054,"slug":3055,"type":15},"Debugging","debugging",{"name":3044,"slug":3045,"type":15},{"name":3058,"slug":3059,"type":15},"Triage","triage","2026-07-14T05:25:57.442089",{"slug":3062,"name":3062,"fn":3063,"description":3064,"org":3065,"tags":3066,"stars":3021,"repoUrl":3022,"updatedAt":3073},"mcore-linting-and-formatting","lint and format Megatron-LM code","Linting and formatting for Megatron-LM. Covers running autoformat.sh, tools (ruff, black, isort, pylint, mypy), and code style rules.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[3067,3070],{"name":3068,"slug":3069,"type":15},"Best Practices","best-practices",{"name":3071,"slug":3072,"type":15},"Code Analysis","code-analysis","2026-07-14T05:25:56.18433",{"slug":3075,"name":3075,"fn":3076,"description":3077,"org":3078,"tags":3079,"stars":3021,"repoUrl":3022,"updatedAt":3087},"mcore-migrate-gpt-to-hybrid","migrate Megatron-LM models to HybridModel","Migration guide for moving Megatron Core GPTModel checkpoints, model providers, training commands, and layer mappings to HybridModel.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[3080,3083,3086],{"name":3081,"slug":3082,"type":15},"Machine Learning","machine-learning",{"name":3084,"slug":3085,"type":15},"Migration","migration",{"name":9,"slug":8,"type":15},"2026-07-17T06:07:11.777011",{"slug":3089,"name":3089,"fn":3090,"description":3091,"org":3092,"tags":3093,"stars":3021,"repoUrl":3022,"updatedAt":3100},"mcore-onboard-gb200-1node-tests","onboard functional tests for GB200","Onboard 1-node GitHub MR functional tests for GB200 from existing mr-scoped 2-node tests.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[3094,3097],{"name":3095,"slug":3096,"type":15},"QA","qa",{"name":3098,"slug":3099,"type":15},"Testing","testing","2026-07-14T05:25:53.673039",{"slug":3102,"name":3102,"fn":3103,"description":3104,"org":3105,"tags":3106,"stars":3021,"repoUrl":3022,"updatedAt":3111},"mcore-run-on-slurm","launch distributed training jobs on SLURM","How to launch distributed Megatron-LM training jobs on a SLURM cluster. Covers a minimal sbatch skeleton, environment-variable setup for torch.distributed.run, CUDA_DEVICE_MAX_CONNECTIONS rules across hardware and parallelism modes, container conventions, monitoring, and per-rank failure diagnosis.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[3107,3108],{"name":3017,"slug":3018,"type":15},{"name":3109,"slug":3110,"type":15},"Infrastructure","infrastructure","2026-07-14T05:25:49.362534",{"slug":3113,"name":3113,"fn":3114,"description":3115,"org":3116,"tags":3117,"stars":3021,"repoUrl":3022,"updatedAt":3125},"mcore-split-pr","split pull requests to reduce review load","Split a PR into multiple PRs to reduce the number of required CODEOWNERS reviewer groups.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[3118,3121,3122],{"name":3119,"slug":3120,"type":15},"Code Review","code-review",{"name":3044,"slug":3045,"type":15},{"name":3123,"slug":3124,"type":15},"Pull Requests","pull-requests","2026-07-14T05:26:01.226578",{"slug":3127,"name":3127,"fn":3128,"description":3129,"org":3130,"tags":3131,"stars":3021,"repoUrl":3022,"updatedAt":3134},"mcore-testing","run and manage Megatron-LM tests","Test system for Megatron-LM. Covers test layout, recipe YAML structure, adding and running unit and functional tests, golden values, marker filters, and CI parity.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[3132,3133],{"name":3095,"slug":3096,"type":15},{"name":3098,"slug":3099,"type":15},"2026-07-14T05:25:54.928983",{"slug":3136,"name":3136,"fn":3137,"description":3138,"org":3139,"tags":3140,"stars":3021,"repoUrl":3022,"updatedAt":3145},"nightly-sync","manage nightly main-to-dev sync workflows","Domain knowledge for the nightly main-to-dev sync workflow. Covers merge strategy, CI architecture, failure investigation, and known issues.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[3141,3144],{"name":3142,"slug":3143,"type":15},"Automation","automation",{"name":3031,"slug":3032,"type":15},"2026-07-30T05:29:03.275638",496,{"items":3148,"total":3244},[3149,3166,3176,3190,3200,3215,3230],{"slug":3150,"name":3150,"fn":3151,"description":3152,"org":3153,"tags":3154,"stars":17,"repoUrl":18,"updatedAt":3165},"accelerated-computing-cudf","accelerate data processing with cuDF","Official NVIDIA-authored guidance for NVIDIA cuDF GPU DataFrames, pandas acceleration, dask-cuDF, ETL, joins, groupby, CSV\u002FParquet I\u002FO, nullable semantics, and multi-GPU DataFrame workloads.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[3155,3158,3161,3162],{"name":3156,"slug":3157,"type":15},"Data Analysis","data-analysis",{"name":3159,"slug":3160,"type":15},"Data Engineering","data-engineering",{"name":9,"slug":8,"type":15},{"name":3163,"slug":3164,"type":15},"Performance","performance","2026-07-14T05:28:43.176466",{"slug":3167,"name":3167,"fn":3168,"description":3169,"org":3170,"tags":3171,"stars":17,"repoUrl":18,"updatedAt":3175},"aiq-deploy","deploy and manage NVIDIA AI-Q infrastructure","Use when asked to install, deploy, run, validate, troubleshoot, or stop NVIDIA AI-Q Blueprint infrastructure.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[3172,3173,3174],{"name":3017,"slug":3018,"type":15},{"name":3109,"slug":3110,"type":15},{"name":9,"slug":8,"type":15},"2026-07-14T05:29:06.667109",{"slug":3177,"name":3177,"fn":3178,"description":3179,"org":3180,"tags":3181,"stars":17,"repoUrl":18,"updatedAt":3189},"aiq-research","conduct deep research with AI-Q","Use when asked to run deep research or AI-Q research through a reachable NVIDIA AI-Q Blueprint backend.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[3182,3185,3186],{"name":3183,"slug":3184,"type":15},"Agents","agents",{"name":9,"slug":8,"type":15},{"name":3187,"slug":3188,"type":15},"Research","research","2026-07-14T05:28:06.816956",{"slug":3191,"name":3191,"fn":3192,"description":3193,"org":3194,"tags":3195,"stars":17,"repoUrl":18,"updatedAt":3199},"amc-run-sample-calibration","run AMC sample dataset calibration","Run end-to-end calibration on the shipped sample dataset (sdg_08_2_sample_data_010926.zip) against a running AMC microservice. Use when user says 'test sample dataset', 'run sample calibration', 'verify AMC install', or 'launch and test'.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[3196,3197,3198],{"name":3156,"slug":3157,"type":15},{"name":9,"slug":8,"type":15},{"name":3098,"slug":3099,"type":15},"2026-07-17T05:29:03.913266",{"slug":3201,"name":3201,"fn":3202,"description":3203,"org":3204,"tags":3205,"stars":17,"repoUrl":18,"updatedAt":3214},"amc-run-video-calibration","calibrate video datasets with AutoMagicCalib","Calibrate a new dataset from pre-recorded video files via the AutoMagicCalib REST API. Use when user has local MP4s and says 'calibrate my videos', 'run AMC on these videos', or similar. For RTSP\u002Flive streams, use amc-run-rtsp-calibration instead.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[3206,3207,3210,3211],{"name":3142,"slug":3143,"type":15},{"name":3208,"slug":3209,"type":15},"Imaging","imaging",{"name":9,"slug":8,"type":15},{"name":3212,"slug":3213,"type":15},"Video","video","2026-07-17T05:28:53.905004",{"slug":3216,"name":3216,"fn":3217,"description":3218,"org":3219,"tags":3220,"stars":17,"repoUrl":18,"updatedAt":3229},"amc-setup-calibration-stack","deploy AutoMagicCalib microservice with Docker","Launch AutoMagicCalib microservice and web UI from NGC release images via Docker Compose. Use when user says 'deploy auto calibration', 'launch auto calibration', 'launch AMC', 'start MS+UI', or 'set up auto-magic-calib'. Requires NGC API key.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[3221,3222,3225,3226],{"name":3017,"slug":3018,"type":15},{"name":3223,"slug":3224,"type":15},"Docker","docker",{"name":9,"slug":8,"type":15},{"name":3227,"slug":3228,"type":15},"Operations","operations","2026-07-17T05:28:56.913999",{"slug":3231,"name":3231,"fn":3232,"description":3233,"org":3234,"tags":3235,"stars":17,"repoUrl":18,"updatedAt":3243},"cudaq-guide","develop quantum applications with CUDA-Q","CUDA-Q onboarding guide for installation, test programs, GPU simulation, QPU hardware, and quantum applications.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[3236,3237,3240],{"name":9,"slug":8,"type":15},{"name":3238,"slug":3239,"type":15},"Quantum Computing","quantum-computing",{"name":3241,"slug":3242,"type":15},"Simulation","simulation","2026-07-14T05:26:58.898253",305]