dali-dynamic-mode

Implement DALI dynamic mode data loading with GPU decode and PyTorch tensor conversion.

Updated May 23, 2026
One-click install
npx skills add https://github.com/yo-steven/skills-exploration-20260522 --skill dali-dynamic-mode
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dali-dynamic-mode
Source: https://github.com/yo-steven/skills-exploration-20260522/tree/main/skills/DALI/dali-dynamic-mode
Command: npx skills add https://github.com/yo-steven/skills-exploration-20260522 --skill dali-dynamic-mode

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you implement and troubleshoot DALI dynamic mode (ndd) data loading and preprocessing so you can reliably decode, augment, and feed data to PyTorch without building a pipeline graph.

Core Features & Use Cases

  • Imperative dynamic mode workflow: Use nvidia.dali.experimental.dynamic as ndd for operator-by-operator execution with normal Python control flow.
  • Correct tensor/batch semantics: Distinguish Tensor vs Batch, use ndd.as_tensor / ndd.as_batch for wrapping, and use batch.select() for choosing samples and batch.slice[...] for slicing within samples.
  • Stateful readers and training loops: Create readers once, reuse them across epochs, and iterate using reader.next_epoch(batch_size=...).
  • GPU-focused device handling: Decode with device="gpu" for dynamic mode (avoid pipeline-mode device="mixed" concepts) and hand off to PyTorch via .torch().
  • Debugging execution timing issues: Use EvalMode.sync_full / sync_cpu to surface errors at the correct call site instead of debugging with scattered evaluate calls.
  • Pipeline-mode to dynamic migration: Convert common pipeline patterns like @pipeline_def, pipe.build()/pipe.run(), output.at(i), and pipeline-level seed/threads into the corresponding dynamic-mode constructs.

Quick Start

Ask for DALI dynamic mode guidance to decode JPEGs on the GPU, resize to 224x224, apply ImageNet normalization, and provide a PyTorch-ready training-loop handoff using .torch().

Frequently Asked Questions about dali-dynamic-mode

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I use DALI dynamic mode for GPU data loading without building a pipeline graph?

DALI dynamic mode uses nvidia.dali.experimental.dynamic for imperative, operator-by-operator execution with normal Python control flow, bypassing traditional pipeline graph construction for GPU-accelerated decode and augmentation.

What is the difference between batch.select and batch.slice in DALI dynamic mode?

In DALI dynamic mode, batch.select() chooses specific samples from the batch, while batch.slice[...] extracts data within individual samples. Correctly distinguishing these semantics prevents tensor manipulation errors.

How do I migrate a DALI pipeline to dynamic mode?

Migrate by replacing @pipeline_def, pipe.build()/pipe.run(), and output.at(i) with imperative dynamic-mode constructs using nvidia.dali.experimental.dynamic, stateful readers, and direct tensor operations.

Why are my DALI dynamic mode errors surfacing in the wrong location during debugging?

Asynchronous execution hides errors from the originating call site. Use ndd.EvalMode.sync_full or ndd.EvalMode.sync_cpu to force synchronous execution and surface errors at the correct operator call location.

Can I hand off DALI dynamic mode batches directly to PyTorch for training?

Yes, after GPU decode, augmentation, and resizing, convert DALI dynamic mode tensors to PyTorch using the .torch() method for direct integration into PyTorch training loops.

How do I iterate through epochs using a DALI dynamic mode reader?

Create DALI readers once and reuse them across epochs by calling reader.next_epoch(batch_size=...). This stateful iteration replaces pipeline-level run cycles for dynamic data loading.