rok commented on code in PR #37533:
URL: https://github.com/apache/arrow/pull/37533#discussion_r1412722784
##########
python/pyarrow/array.pxi:
##########
@@ -3519,16 +3519,32 @@ class FixedShapeTensorArray(ExtensionArray):
def to_numpy_ndarray(self):
"""
Convert fixed shape tensor extension array to a numpy array (with
dim+1).
+ """
+ cdef:
+ CFixedShapeTensorArray* ext_array =
<CFixedShapeTensorArray*>(self.ap)
+ CResult[shared_ptr[CTensor]] ctensor
+ with nogil:
+ ctensor = ext_array.ToTensor()
+ return pyarrow_wrap_tensor(GetResultValue(ctensor)).to_numpy()
Review Comment:
`ToTensor` uses permutation to calculate strides and zero-copy creates
`pyarrow.Tensor`.
`pyarrow.Tensor` can be zero-copy converted to a numpy array. I am not sure
what that conversion does with strides, but we should check.
Updated the docstring.
--
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]