| 473 | } |
| 474 | |
| 475 | Result<std::shared_ptr<Tensor>> SparseTensor::ToTensor(MemoryPool* pool) const { |
| 476 | switch (format_id()) { |
| 477 | case SparseTensorFormat::COO: |
| 478 | return MakeTensorFromSparseCOOTensor( |
| 479 | pool, internal::checked_cast<const SparseCOOTensor*>(this)); |
| 480 | break; |
| 481 | |
| 482 | case SparseTensorFormat::CSR: |
| 483 | return MakeTensorFromSparseCSRMatrix( |
| 484 | pool, internal::checked_cast<const SparseCSRMatrix*>(this)); |
| 485 | break; |
| 486 | |
| 487 | case SparseTensorFormat::CSC: |
| 488 | return MakeTensorFromSparseCSCMatrix( |
| 489 | pool, internal::checked_cast<const SparseCSCMatrix*>(this)); |
| 490 | break; |
| 491 | |
| 492 | case SparseTensorFormat::CSF: |
| 493 | return MakeTensorFromSparseCSFTensor( |
| 494 | pool, internal::checked_cast<const SparseCSFTensor*>(this)); |
| 495 | |
| 496 | default: |
| 497 | return Status::NotImplemented("Unsupported SparseIndex format type"); |
| 498 | } |
| 499 | } |
| 500 | |
| 501 | } // namespace arrow |
nothing calls this directly
no test coverage detected