Avoid deprecated nvcv_image conversion#1978
Conversation
Signed-off-by: nightcityblade <nightcityblade@gmail.com>
Greptile SummaryThis PR replaces the deprecated
Confidence Score: 5/5Safe to merge — the change is a targeted removal of a deprecated API with no new logic paths introduced. The diff swaps a deprecated two-step conversion (nvcv_image → as_image → as_tensor) for the single recommended call. No new branching, no altered data flow, and the removed error branch was genuinely unreachable after the change. Tests are updated in parallel to match the new call signature. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[decoded_frame from nvDec.Decode] --> B["cvcuda.as_tensor(decoded_frame, 'NCHW')"]
B --> C[cvcuda_tensor with NCHW shape]
C --> D["Compute nhwc_shape from nchw_shape"]
D --> E["torch.empty(nhwc_shape, dtype=uint8, device=cuda:N)"]
E --> F["cvcuda.as_tensor(torch_nhwc, 'NHWC')"]
F --> G["cvcuda.reformat_into(cvcuda_nhwc, cvcuda_tensor)"]
G --> H["input_frame_list.put(torch_nhwc)"]
Reviews (2): Last reviewed commit: "Remove redundant decoded frame layout gu..." | Re-trigger Greptile |
|
Thanks Greptile — I agree the post-conversion NCHW layout guard became redundant after requesting NCHW directly via cvcuda.as_tensor(decoded_frame, "NCHW"). I pushed a follow-up commit that removes that dead branch and drops the stale unit test that only exercised the removed guard.\n\nValidation:\n- ruff check nemo_curator/utils/nvcodec_utils.py tests/utils/test_nvcodec_utils.py: passed\n- ruff format --check nemo_curator/utils/nvcodec_utils.py tests/utils/test_nvcodec_utils.py: passed\n- pytest tests/utils/test_nvcodec_utils.py: blocked locally on macOS because NeMo-Curator currently raises on non-Linux systems during import |
Description
Replace the deprecated
DecodedFrame.nvcv_image()conversion inNvVideoDecoder.generate_decoded_frameswith direct CV-CUDA tensor wrapping of the decoded frame.Closes #1512.
Usage
Checklist