jorisvandenbossche commented on code in PR #33925:
URL: https://github.com/apache/arrow/pull/33925#discussion_r1106889597
##########
docs/source/format/CanonicalExtensions.rst:
##########
@@ -72,4 +72,57 @@ 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 tensors and
+ is an instance of ``pyarrow.DataType`` or ``pyarrow.Field``.
+ * **list_size** is the product of all the elements in tensor shape.
+
+* Extension type parameters:
+
+ * **value_type** = Arrow DataType of the tensor elements
+ * **shape** = shape of the contained tensors as a tuple
+
+* Description of the serialization:
+
+ The metadata must be a valid JSON object including shape of
+ the contained tensors as an array with key **"shape"**
+
+ - example: ``{ "shape": [2, 5]}``
+
+ and optional:
+
+ - **"dim_names"** holds 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.
+
+ Example of dim_names metadata for NCHW ordered data:
+
+ ``{ "shape": [100, 200, 500], "dim_names": ["C", "H", "W"]}``
+
+ The ``dim_names`` metadata can be added if the dimensions have
+ well-known names that can map to the physical order (row-major).
Review Comment:
```suggestion
well-known names and map to the physical order (row-major).
```
I am not sure the "can" is needed here. I would say that if you have
dimension names, they always _can_ be mapped to the physical order, but what is
relevant here is that indeed you _should_ list them in that order.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]