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

Fix inconsistent tensor recreation in TensorList #4286

Merged
merged 2 commits into from
Sep 27, 2022

Conversation

klecki
Copy link
Contributor

@klecki klecki commented Sep 26, 2022

Category: Bug fix

Description:

Use the same shape for the internal tensor that gets back into the scope when the size of the TensorList is changed. empty_shape can be only used for non-zero dimensional samples, as 0d samples can't have 0 volume.

The code uses an explicit TensorShape<0> converted to one of dynamic dimension, as the brace default constructed TensorShape<> had size 1 for some reason.

This clears up potential asserts that could hit in debug builds: specifically calling empty_shape for dim = 0.

Signed-off-by: Krzysztof Lecki klecki@nvidia.com

Additional information:

Affected modules and functionalities:

TensorList

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

Use the same shape for the internal tensor that gets back into the scope
when the size of the TensorList is changed. empty_shape can be only used
for non-zero dimensional samples, as 0d samples can't have 0 volume.

The code uses an explicit TensorShape<0> converted to one of dynamic
dimension, as the brace default constructed TensorShape<> had size 1 for
some reason.

This clears up potential asserts that could hit in debug builds:
specifically calling empty_shape for dim = 0.

Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
@klecki
Copy link
Contributor Author

klecki commented Sep 26, 2022

!build

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [6015231]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [6015231]: BUILD PASSED

Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
@klecki
Copy link
Contributor Author

klecki commented Sep 27, 2022

!build

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [6024719]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [6024719]: BUILD PASSED

@klecki klecki merged commit dde23a0 into NVIDIA:main Sep 27, 2022
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.

None yet

4 participants