rok commented on issue #45531:
URL: https://github.com/apache/arrow/issues/45531#issuecomment-2657254726

   Thanks for reporting this @schmidt-ai !
   A slightly reduced example of this:
   ```python
   import numpy as np
   import pyarrow as pa
   
   tensor_type = pa.fixed_shape_tensor(value_type=pa.float64(), shape=(5, 6), 
dim_names=("a", "b"))
   arr = pa.FixedShapeTensorArray.from_numpy_ndarray(np.random.rand(10, 5, 6))
   arr.cast(tensor_type)
   ```
   Note: value type is pa.float64 as np.random will usually produce 64 bit 
floats.
   
   As a workaround you can do this:
   ```python
   arr2 = pa.FixedShapeTensorArray.from_storage(tensor_type, arr.storage)
   ```
   
   I do agree it would be nice to have `dim_names` parameter in 
`from_numpy_ndarray`. I can perhaps pick this up when I have time and of course 
PRs are welcome!


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