Fixing Tensor Extents #152
Unanswered
amitsingh19975
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
There is an issue with the current implementation of
extents
where we cannot discern the difference betweenstatic extents
andfixed rank extents
when the order of extents is one.Solution 1
Introduce an invariant where the order of
extents
is always greater than one. It makes theextents
distinguishable.But one problem arises with this approach: we lose the ability to alias our tensor into vector. This problem only plagues
fixed rank tensor
because when we create a vector through an alias, we always have to provide one and the size of the vector.And I don't know which solution is better:
Solution 2
We change the static extents' first element into the size of the extents and keep everything the same.
Solution 3
Use C++ 20 feature, "template non-type arguments," where the first template argument for fixed rank extents could be some other type than "std::size_t." And if we get "std::size_t," we can be hundred per cent sure that it's static extents.
Personal comment
I'm more inclined with solution one.
Beta Was this translation helpful? Give feedback.
All reactions