Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 4.3k
GH-33923: [Docs] Tensor canonical extension type specification#33925
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
Merged
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
af571cb
Add Fixed size tensor spec to canonical extensions list
AlenkaF 8231150
Apply suggestions from code review
AlenkaF 884d871
Remove implementation-specific metadata
AlenkaF 83edd70
Change order with is_row_major
AlenkaF 16ef6f1
Update docs/source/format/CanonicalExtensions.rst
AlenkaF 4f4ccce
Update metadata part
AlenkaF 92fd7c6
Correct True to true in json
AlenkaF 7873676
Change name from fixed_size_tensor to fixed_shape_tensor
AlenkaF a4219e3
Add description for ListType parameters
AlenkaF 37e83db
Change the description for ListType parameters
AlenkaF 5c92ff0
Remove is_row_major from the spec
AlenkaF cb5e2dd
Add dim_names and permutation to optional metadata
AlenkaF b562b8d
Add notes to the usage of dim_names and permutations metadata
AlenkaF c44101b
Update docs/source/format/CanonicalExtensions.rst
AlenkaF 24e7c28
Add dim_names and permutation to optional parameters
AlenkaF 333ae67
Add explicit explanation of permutation indices
AlenkaF 4086dfb
Change order with layout
AlenkaF bd2a515
Rephrase text about absent permutation param
AlenkaF bc07d7a
Apply suggestions from code review - Joris
AlenkaF 68c6244
Remove redundant sentence in permutations explanation
AlenkaF 3e2bb25
Update value_type description
AlenkaF a49f14f
Update parameters description
AlenkaF 89d8042
Add a logical layout shape example in the desc of the serialization
AlenkaF 4ff7a65
Update docs/source/format/CanonicalExtensions.rst
AlenkaF 1daf820
Update docs/source/format/CanonicalExtensions.rst
AlenkaF 70059d9
Add note about IPC tensor
AlenkaF 6f44296
Update docs/source/format/CanonicalExtensions.rst
AlenkaF File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -72,4 +72,76 @@ same rules as laid out above, and provide backwards compatibility guarantees. | ||
| Official List | ||
| ============= | ||
| No canonical extension types have been standardized yet. | ||
| Fixed shape tensor | ||
| ================== | ||
| * Extension name: `arrow.fixed_shape_tensor`. | ||
| * The storage type of the extension: ``FixedSizeList`` where: | ||
| * **value_type** is the data type of individual tensor elements. | ||
| * **list_size** is the product of all the elements in tensor shape. | ||
| * Extension type parameters: | ||
| * **value_type** = the Arrow data type of individual tensor elements. | ||
| * **shape** = the physical shape of the contained tensors | ||
| as an array. | ||
| Optional parameters describing the logical layout: | ||
| * **dim_names** = explicit names to tensor dimensions | ||
| as an array. The length of it should be equal to the shape | ||
| length and equal to the number of dimensions. | ||
| ``dim_names`` can be used if the dimensions have well-known | ||
| names and they map to the physical layout (row-major). | ||
| * **permutation** = indices of the desired ordering of the | ||
| original dimensions, defined as an array. | ||
| The indices contain a permutation of the values [0, 1, .., N-1] where | ||
| N is the number of dimensions. The permutation indicates which | ||
| dimension of the logical layout corresponds to which dimension of the | ||
| physical tensor (the i-th dimension of the logical view corresponds | ||
| to the dimension with number ``permutations[i]`` of the physical tensor). | ||
| Permutation can be useful in case the logical order of | ||
| the tensor is a permutation of the physical order (row-major). | ||
paleolimbot marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| When logical and physical layout are equal, the permutation will always | ||
| be ([0, 1, .., N-1]) and can therefore be left out. | ||
| * Description of the serialization: | ||
| The metadata must be a valid JSON object including shape of | ||
| the contained tensors as an array with key **"shape"** plus optional | ||
| dimension names with keys **"dim_names"** and ordering of the | ||
| dimensions with key **"permutation"**. | ||
| - Example: ``{ "shape": [2, 5]}`` | ||
| - Example with ``dim_names`` metadata for NCHW ordered data: | ||
| ``{ "shape": [100, 200, 500], "dim_names": ["C", "H", "W"]}`` | ||
| - Example of permuted 3-dimensional tensor: | ||
| ``{ "shape": [100, 200, 500], "permutation": [2, 0, 1]}`` | ||
| This is the physical layout shape and the the shape of the logical | ||
| layout would in this case be ``[500, 100, 200]``. | ||
| .. note:: | ||
| Elements in a fixed shape tensor extension array are stored | ||
| in row-major/C-contiguous order. | ||
| .. note:: | ||
| Other Data Structures in Arrow include a | ||
| `Tensor (Multi-dimensional Array) <https://arrow.apache.org/docs/format/Other.html>`_ | ||
| to be used as a message in the interprocess communication machinery (IPC). | ||
| This structure has no relationship with the Fixed shape tensor extension type defined | ||
| by this specification. Instead, this extension type lets one use fixed shape tensors | ||
| as elements in a field of a RecordBatch or a Table. | ||
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.