Add ndd.imread function for reading and decoding images by jantonguirao · Pull Request #6092 · NVIDIA/DALI

github-advanced-security[bot]

bot found potential problems Nov 20, 2025

JanuszL

greptile-apps[bot]

greptile-apps[bot]

greptile-apps[bot]

greptile-apps[bot]

greptile-apps[bot]

banasraf

banasraf

banasraf

This adds a new imread() function to the experimental dynamic API that provides
a simple interface for loading images from file paths. The function combines
io.file.read and decoders.image operations into a single convenient call.

Features:
- Supports single image (returns Tensor) or batch of images (returns Batch)
- Supports CPU and GPU decoding (device: 'cpu', 'mixed')
- Accepts string paths, lists of paths, or Tensor/Batch inputs
- Forwards all kwargs to decoders.image for full control over decoding

Implementation details:
- Dynamically expands function signature with all decoders.image kwargs using makefun
- Automatically generates comprehensive docstring by extracting kwargs documentation
  from decoders.image schema using ops._docs._get_kwargs()
- Provides full IDE autocomplete support for ~20 decoder parameters
- Excludes unsupported/internal args (bytes_per_sample_hint, preserve)

Signed-off-by: Joaquin Anton Guirao <janton@nvidia.com>
Signed-off-by: Joaquin Anton Guirao <janton@nvidia.com>
Signed-off-by: Joaquin Anton Guirao <janton@nvidia.com>
Signed-off-by: Joaquin Anton Guirao <janton@nvidia.com>

greptile-apps[bot]

@jantonguirao

Signed-off-by: Joaquin Anton Guirao <janton@nvidia.com>

greptile-apps[bot]