[Tensor] Disambiguate undefined Tensor dimensions from Scalar Tensor
Define a Tensor with undefined dims by explicitly setting mSize to 0. Provide undefined() method which must be used instead of empty() to test whether a Tensor as associated dimensions and can be used for forwarding dimensions downward. This disambiguates from defined scalar Tensor which actually have empty dimensions, but size of 1. Note that as soon as a Tensor with undefined dimensions is resized, it's dimensions are permanently defined (though may still change). This change solves issues in operators forwardDims() when input values are scalar, i.e. !undefined() and empty().
Showing
- include/aidge/data/Tensor.hpp 25 additions, 8 deletionsinclude/aidge/data/Tensor.hpp
- include/aidge/operator/Identity.hpp 1 addition, 1 deletioninclude/aidge/operator/Identity.hpp
- python_binding/data/pybind_Tensor.cpp 1 addition, 0 deletionspython_binding/data/pybind_Tensor.cpp
- src/backend/OperatorImpl.cpp 3 additions, 3 deletionssrc/backend/OperatorImpl.cpp
- src/data/Tensor.cpp 2 additions, 3 deletionssrc/data/Tensor.cpp
- src/graph/GraphView.cpp 4 additions, 4 deletionssrc/graph/GraphView.cpp
- src/operator/Gather.cpp 1 addition, 1 deletionsrc/operator/Gather.cpp
- src/operator/Memorize.cpp 3 additions, 3 deletionssrc/operator/Memorize.cpp
- src/operator/OperatorTensor.cpp 3 additions, 3 deletionssrc/operator/OperatorTensor.cpp
- src/operator/Reshape.cpp 1 addition, 1 deletionsrc/operator/Reshape.cpp
- src/operator/Resize.cpp 7 additions, 7 deletionssrc/operator/Resize.cpp
- src/operator/Slice.cpp 4 additions, 4 deletionssrc/operator/Slice.cpp
- src/operator/Split.cpp 1 addition, 1 deletionsrc/operator/Split.cpp
- unit_tests/data/Test_Tensor.cpp 1 addition, 1 deletionunit_tests/data/Test_Tensor.cpp
- unit_tests/operator/Test_GlobalAveragePooling_Op.cpp 1 addition, 3 deletionsunit_tests/operator/Test_GlobalAveragePooling_Op.cpp
Loading
Please register or sign in to comment