pratyushadk commented on code in PR #50907:
URL: https://github.com/apache/arrow/pull/50907#discussion_r3855951066
##########
python/pyarrow/tensor.pxi:
##########
@@ -871,6 +871,8 @@ shape: {self.shape}"""
obj : Tensor
The dense tensor that should be converted.
"""
+ if obj.ndim == 1:
+ obj = Tensor.from_numpy(obj.to_numpy().reshape(1, obj.shape[0]))
Review Comment:
That makes sense, reverted the `from_tensor` changes. I've added validation
in `from_scipy` to reject non-2D input (previously
`from_scipy(csr_array(1d_array))` would silently create an invalid 1D
SparseCSRMatrix). The test now verifies the `from_scipy` roundtrip with
`csr_matrix`/`csc_matrix`, which normalize 1D to `(1, n)`.
--
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]