Uh oh!
There was an error while loading. Please reload this page.
GH-24868: [C++] Add a Tensor logical value type with varying dimensions, implemented using ExtensionType - #37166
Conversation
31f9dc6 to
db8d764Compare
westonpace
left a comment
There was a problem hiding this comment.
I just looked through the rst portion and have a few questions.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Looking at PyTorch This makes me assume strides are stored for caching (and not to allow variable data layout per tensor). Should we adjust to store permutations (or strides) per row too or rather leave that for another extension ( |
lhoestq
commented
Aug 28, 2023
No strong opinion regarding storing strides. Cc @thomasw21 I'm not even sure that nested tensors are used that often no ? I'm also pinging other experts to get more insights. |
AlenkaF
commented
Aug 28, 2023
How much extra complexity is added if we enable each tensor in an array to have it's own permutation defined? |
@AlenkaF Storing permutations would allow per tensor memory layout, which I'm not sure is really needed in practice and could be confusing and complex. |
0c43cd1 to
3390915CompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Antoine Pitrou <pitrou@free.fr>
Co-authored-by: Antoine Pitrou <pitrou@free.fr>
rok
commented
Oct 5, 2023
Thank for the suggestions @pitrou! If there's nothing further I'd tally the vote on ML and merge this. |
Uh oh!
There was an error while loading. Please reload this page.
| non-uniform dimensions. This holds over all tensors in the array. | ||
| Sizes in uniform dimensions are represented with int32 values, while | ||
| sizes of the non-uniform dimensions are not known in advance and are | ||
| represented with 0s. If ``uniform_shape`` is not provided it is assumed |
There was a problem hiding this comment.
Should we rather take "-1" istead of "0"? We have some other places where we use -1 for "unknown" (eg null counts)
There was a problem hiding this comment.
Or JSON supports null which maps quite naturally to what we are trying to express, IMHO.
There was a problem hiding this comment.
Switched language to null. This is similar to what pytorch and tensorflow do (they use None in python).
Co-authored-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
pitrou
commented
Oct 5, 2023
@jorisvandenbossche Can I let you give this the final review? |
rok
commented
Oct 6, 2023
@jorisvandenbossche can we merge this? |
| - Example of minimal metadata is: | ||
| ``{}`` |
There was a problem hiding this comment.
Sorry, one more small nitpick: the minimal metadata is actually no metadata, which is typically represented as an empty string (I am actually not fully sure if in this case the metadata key could also just not be present in the field metadata), instead of an empty json dict (I don't think we should necessarily recommend using an empty dict)
There was a problem hiding this comment.
That's a fair point! Empty string feels like the safer choice here. See my suggested change below.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Rok Mihevc <rok@mihevc.org>
jorisvandenbossche
commented
Oct 11, 2023
Thanks a lot @rok ! |
After merging your PR, Conbench analyzed the 6 benchmarking runs that have been run so far on merge-commit a7fab04. There were no benchmark performance regressions. 🎉 The full Conbench report has more details. It also includes information about 2 possible false positives for unstable benchmarks that are known to sometimes produce them. |
Rationale for this change
For use cases where underlying datatype and number of dimensions in tensors are equal but not the actual shape we want to add a
VariableShapeTensorType.See #24868 and huggingface/datasets#5272
What changes are included in this PR?
This introduces definition of
arrow.variable_shape_tensorextension and it's C++ implementation and a Python wrapper.Are these changes tested?
Yes.
Are there any user-facing changes?
This introduces new extension type to the user.