Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metadata accessor #5650

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Metadata accessor #5650

wants to merge 2 commits into from

Conversation

mzient
Copy link
Contributor

@mzient mzient commented Sep 27, 2024

Category:

New feature (non-breaking change which adds functionality)
Refactoring (Redesign of existing code that doesn't affect functionality)

Description:

This PR reimplements GetProperty to allow for:

  • reuse of the 1st sample when the property is uniform across samples
  • return the data on any backend
  • return the data from input on any (Metadata) backend

It also introduces DataNode.metadata function and a shortcut for source_info.

NOTE layout doesn't get a dedicated accessor, since we want to have a static (build-time) layout and dtype.

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
  • X] N/A

DALI team only

Requirements

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

REQ IDs: N/A

JIRA TASK: N/A

mzient and others added 2 commits September 26, 2024 17:43
Signed-off-by: Michal Zientkiewicz <michalz@nvidia.com>
Signed-off-by: Michał Zientkiewicz <mzient@gmail.com>
@@ -15,7 +15,8 @@
from nvidia.dali import pipeline_def
import os
import numpy as np
from nvidia.dali import fn
import nvidia.dali as dali

Check notice

Code scanning / CodeQL

Module is imported with 'import' and 'import from' Note test

Module 'nvidia.dali' is imported with both 'import' and 'import from'.
return to_cpu(gpu)

with assert_raises(RuntimeError, glob="doesn't support transition from GPU to CPU"):
pipe = pdef(lambda gpu: gpu.cpu()) # this will raise an error at construction time

Check warning

Code scanning / CodeQL

Variable defined multiple times Warning test

This assignment to 'pipe' is unnecessary as it is
redefined
before this value is used.
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.

3 participants