| 457 | } |
| 458 | |
| 459 | Result<std::shared_ptr<Tensor>> SparseTensor::ToTensor(MemoryPool* pool) const { |
| 460 | switch (format_id()) { |
| 461 | case SparseTensorFormat::COO: |
| 462 | return MakeTensorFromSparseCOOTensor( |
| 463 | pool, internal::checked_cast<const SparseCOOTensor*>(this)); |
| 464 | break; |
| 465 | |
| 466 | case SparseTensorFormat::CSR: |
| 467 | return MakeTensorFromSparseCSRMatrix( |
| 468 | pool, internal::checked_cast<const SparseCSRMatrix*>(this)); |
| 469 | break; |
| 470 | |
| 471 | case SparseTensorFormat::CSC: |
| 472 | return MakeTensorFromSparseCSCMatrix( |
| 473 | pool, internal::checked_cast<const SparseCSCMatrix*>(this)); |
| 474 | break; |
| 475 | |
| 476 | case SparseTensorFormat::CSF: |
| 477 | return MakeTensorFromSparseCSFTensor( |
| 478 | pool, internal::checked_cast<const SparseCSFTensor*>(this)); |
| 479 | |
| 480 | default: |
| 481 | return Status::NotImplemented("Unsupported SparseIndex format type"); |
| 482 | } |
| 483 | } |
| 484 | |
| 485 | } // namespace arrow |
nothing calls this directly
no test coverage detected