rok commented on PR #34883:
URL: https://github.com/apache/arrow/pull/34883#issuecomment-1503028476

   An example of `pyarrow -> numpy` conversion that loses permutaion/strides:
   ```python
   import pyarrow as pa
   from numpy.testing import assert_array_equal
   
   tensor_type1 = pa.fixed_shape_tensor(pa.int8(), [2, 2, 3], permutation=[0, 
1, 2])
   tensor_type2 = pa.fixed_shape_tensor(pa.int8(), [2, 2, 3], permutation=[2, 
1, 0])
   storage = pa.array([[1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6]], 
pa.list_(pa.int8(), 12))
   arr1 = pa.ExtensionArray.from_storage(tensor_type1, storage)
   arr2 = pa.ExtensionArray.from_storage(tensor_type1, storage)
   narr1 = arr1.to_numpy_ndarray()
   narr2 = arr2.to_numpy_ndarray()
   
   assert_array_equal(narr1, narr2)
   assert arr1.equals(arr2)
   ```
   
   If `arr2.to_numpy_ndarray()` would throw an error saying this currently 
(we'd want to add it at some point) can't handle permuted conversion I think 
we'd be ok.


-- 
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]

Reply via email to