Allow passing tensor arguments in reader constructors#6252
Conversation
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Greptile SummaryThis PR allows tensor arguments (numpy arrays, PyTorch tensors, Confidence Score: 4/5
Important Files Changed
|
ed9a066 to
c498545
Compare
|
!build |
|
CI MESSAGE: [45875629]: BUILD STARTED |
|
CI MESSAGE: [45875629]: BUILD FAILED |
mzient
left a comment
There was a problem hiding this comment.
To change:
- make a copy tensor arguments
- do not promote non-tensor arguments to tensors
- simplify caller_depth logic
51fb904 to
f283da0
Compare
@greptileai This is not necessary. Readers are now the only operators publicly exposed as classes. |
|
That makes sense - if readers are the only operators exposed as classes, then the change is already naturally scoped correctly. Thanks for the clarification! |
|
!build |
|
CI MESSAGE: [46240320]: BUILD STARTED |
|
CI MESSAGE: [46240320]: BUILD PASSED |
…al tensors Signed-off-by: Rostan Tabet <rtabet@nvidia.com>
Signed-off-by: Rostan Tabet <rtabet@nvidia.com>
Signed-off-by: Rostan Tabet <rtabet@nvidia.com>
Signed-off-by: Rostan Tabet <rtabet@nvidia.com>
Signed-off-by: Rostan Tabet <rtabet@nvidia.com>
Signed-off-by: Rostan Tabet <rtabet@nvidia.com>
… _process_tensor_args Signed-off-by: Rostan Tabet <rtabet@nvidia.com>
PR NVIDIA#6262 fixes the caller depth properly. Signed-off-by: Rostan Tabet <rtabet@nvidia.com>
Signed-off-by: Rostan Tabet <rtabet@nvidia.com>
da6080c to
0a640ea
Compare
|
!build |
|
CI MESSAGE: [46597957]: BUILD STARTED |
|
CI MESSAGE: [46597957]: BUILD PASSED |
Signed-off-by: Rostan Tabet <rtabet@nvidia.com>
|
!build |
|
CI MESSAGE: [48420838]: BUILD STARTED |
|
CI MESSAGE: [48420838]: BUILD FAILED |
…batch_size if None Signed-off-by: Rostan Tabet <rtabet@nvidia.com>
54ac4db to
0b312d3
Compare
|
!build |
|
CI MESSAGE: [48484543]: BUILD STARTED |
|
CI MESSAGE: [48484543]: BUILD PASSED |
* Support constructing readers with tensor args * Detect when default values are passed when invoking a reader * Add tests passing tensor arguments * Disallow constructing a reader with batch kwargs * Update signature of reader constructors to allow tensor arguments * Update NumpyReader example to pass ROI in the reader constructor * Prevent processing again tensor args when not necessary in batch processing * Cache processed tensor args passed in the constructor * Fix caller_depth handling. Remove special case for readers * Pass scalar arguments directly to reader constructors and copy external tensors * Properly use reader tensor args in TorchData integration * Copy all tensors passed to constructors and perform only broadcast in _process_tensor_args * Perform dtype conversion of reader constructor arguments --------- Signed-off-by: Rostan Tabet <rtabet@nvidia.com>
Category:
New feature (non-breaking change which adds functionality)
Description:
Currently, it is necessary to invoke readers in order to pass tensor arguments. The recommended way to use readers is with
next_epochand the__call__API is not even documented.This PR allows constructing readers with tensor arguments.
Additional information:
Affected modules and functionalities:
Dynamic mode.
Key points relevant for the review:
Tests:
Checklist
Documentation
DALI team only
Requirements
REQ IDs: N/A
JIRA TASK: DALI-4600