MCPcopy Create free account
hub / github.com/apache/arrow / ToTensor

Method ToTensor

cpp/src/arrow/sparse_tensor.cc:475–499  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

473}
474
475Result<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

Callers

nothing calls this directly

Calls 6

format_idFunction · 0.85
NotImplementedFunction · 0.70

Tested by

no test coverage detected