| 303 | } |
| 304 | |
| 305 | Status SparseCOOTensorToNdarray(const std::shared_ptr<SparseCOOTensor>& sparse_tensor, |
| 306 | PyObject* base, PyObject** out_data, |
| 307 | PyObject** out_coords) { |
| 308 | const auto& sparse_index = arrow::internal::checked_cast<const SparseCOOIndex&>( |
| 309 | *sparse_tensor->sparse_index()); |
| 310 | |
| 311 | // Wrap tensor data |
| 312 | OwnedRef result_data; |
| 313 | RETURN_NOT_OK(SparseTensorDataToNdarray( |
| 314 | *sparse_tensor, {static_cast<npy_intp>(sparse_tensor->non_zero_length()), 1}, base, |
| 315 | result_data.ref())); |
| 316 | |
| 317 | // Wrap indices |
| 318 | PyObject* result_coords; |
| 319 | RETURN_NOT_OK(TensorToNdarray(sparse_index.indices(), base, &result_coords)); |
| 320 | |
| 321 | *out_data = result_data.detach(); |
| 322 | *out_coords = result_coords; |
| 323 | return Status::OK(); |
| 324 | } |
| 325 | |
| 326 | Status SparseCSXMatrixToNdarray(const std::shared_ptr<SparseTensor>& sparse_tensor, |
| 327 | PyObject* base, PyObject** out_data, |
nothing calls this directly
no test coverage detected