Skip to content

Torchvision API to tensor/PIL image conversion operators #6282

Open
mdabek-nvidia wants to merge 80 commits intoNVIDIA:mainfrom
mdabek-nvidia:torchvision_totensor
Open

Torchvision API to tensor/PIL image conversion operators #6282
mdabek-nvidia wants to merge 80 commits intoNVIDIA:mainfrom
mdabek-nvidia:torchvision_totensor

Conversation

@mdabek-nvidia
Copy link
Copy Markdown
Collaborator

Category:

New feature

Description:

Set of operators that convert from/to torch.Tensor or PIL.Image

Additional information:

Affected modules and functionalities:

Key points relevant for the review:

Tests:

  • Existing tests apply
  • New tests added
    • Python tests
    • GTests
    • Benchmark
    • Other
  • N/A

Checklist

Documentation

  • Existing documentation applies
  • Documentation updated
    • Docstring
    • Doxygen
    • RST
    • Jupyter
    • Other
  • N/A

DALI team only

Requirements

  • Implements new requirements
  • Affects existing requirements
  • N/A

REQ IDs: N/A

JIRA TASK: N/A

mdabek-nvidia and others added 30 commits March 19, 2026 13:30
Signed-off-by: Marek Dabek <mdabek@nvidia.com>
Signed-off-by: Marek Dabek <mdabek@nvidia.com>
Signed-off-by: Marek Dabek <mdabek@nvidia.com>
Signed-off-by: Marek Dabek <mdabek@nvidia.com>
Co-authored-by: Kamil Tokarski <kamiltokarski04@gmail.com>
Signed-off-by: Marek Dabek <mdabek@nvidia.com>
Signed-off-by: Marek Dabek <mdabek@nvidia.com>
Signed-off-by: Marek Dabek <mdabek@nvidia.com>
Signed-off-by: Marek Dabek <mdabek@nvidia.com>
Signed-off-by: Marek Dabek <mdabek@nvidia.com>
Signed-of-by: Marek Dabek <mdabek@nvidia.com>
Signed-off-by: Marek Dabek <mdabek@nvidia.com>
Signed-off-by: Marek Dabek <mdabek@nvidia.com>
Center crop operators implementation

Signed-off-by: Marek Dabek <mdabek@nvidia.com>
Co-authored-by: Kamil Tokarski <kamiltokarski04@gmail.com>
Signed-off-by: Marek Dabek <mdabek@nvidia.com>
Signed-off-by: Marek Dabek <mdabek@nvidia.com>
Signed-off-by: Marek Dabek <mdabek@nvidia.com>
Signed-off-by: Marek Dabek <mdabek@nvidia.com>
…VIDIA#6262)

* Improve call stack depth handling for error tracebacks in dynamic mode
* Rework exception_tester to automatically infer expected line and message
---------

Signed-off-by: Rostan Tabet <rtabet@nvidia.com>
Add uniform_sample option to VideoReaderDecoder

  Adds a `uniform_sample` argument that samples exactly `sequence_length`                                                               
  frames uniformly across the full video (or ROI) using linspace with
  std::round rounding. Each video produces one sample per epoch; `stride`                                                               
  and `step` are ignored (with a DALI_WARN if `pad_mode` is also set).                                                                
  `sequence_length` must be >= 1 when `uniform_sample=True`.                                                                            
                                                                                                                                        
  To avoid a per-sample heap allocation, VideoSampleDesc::frame_idxs_                                                                   
  changes from std::vector<int> to span<const int>. Owned storage moves                                                                 
  to all_frame_idxs_ (vector<vector<int>>) in the loader, which is                                                                      
  populated once in PrepareMetadataImpl and stable for the loader's                                                                     
  lifetime. The copy in ReadSample becomes a cheap 16-byte span copy.                                                                   
  all_frame_idxs_ is declared before samples_ so its lifetime encloses                                                                  
  the spans, preventing dangling references on destruction.                                                                             
                                                                                                                                        
  New tests:                                                                                                                            
  - test_uniform_sample_basic: verifies frame indices match expected linspace                                                           
  - test_uniform_sample_file_list_roi: ROI with non-zero start_frame via file_list                                                      
  - test_uniform_sample_sequence_length_zero_raises: sequence_length=0 raises                                                           
  - test_uniform_sample_stride_step_ignored: stride/step have no effect                                                                 
                                                                                                                                        
  Signed-off-by: Joaquin Anton Guirao <janton@nvidia.com>
- cudaDeviceSynchronize returns cudaErrorStreamCaptureUnsupported when any
  stream on the device is being captured. DLTensorGraveyard now puts pending
  deletions back in the queue and retries after a short wait instead of
  propagating the error.

Signed-off-by: Janusz Lisiecki <jlisiecki@nvidia.com>
* Torchvision ColorJitter and Grayscale implementations

Signed-off-by: Marek Dabek <mdabek@nvidia.com>
Signed-off-by: Marek Dabek <mdabek@nvidia.com>
Signed-off-by: Marek Dabek <mdabek@nvidia.com>
Signed-off-by: Marek Dabek <mdabek@nvidia.com>
Signed-off-by: Marek Dabek <mdabek@nvidia.com>
Signed-off-by: Marek Dabek <mdabek@nvidia.com>
Signed-off-by: Marek Dabek <mdabek@nvidia.com>
Signed-off-by: Marek Dabek <mdabek@nvidia.com>
Signed-off-by: Marek Dabek <mdabek@nvidia.com>
Signed-off-by: Marek Dabek <mdabek@nvidia.com>
Signed-off-by: Marek Dabek <mdabek@nvidia.com>
Signed-off-by: Marek Dabek <mdabek@nvidia.com>
Signed-off-by: Marek Dabek <mdabek@nvidia.com>
Signed-off-by: Marek Dabek <mdabek@nvidia.com>
Signed-off-by: Marek Dabek <mdabek@nvidia.com>
@mdabek-nvidia mdabek-nvidia force-pushed the torchvision_totensor branch 2 times, most recently from b0f10bc to 40fb21b Compare April 14, 2026 09:57
@mdabek-nvidia
Copy link
Copy Markdown
Collaborator Author

!build

@dali-automaton
Copy link
Copy Markdown
Collaborator

CI MESSAGE: [48488201]: BUILD STARTED

Signed-off-by: Marek Dabek <mdabek@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants