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

Method ToTensor

cpp/src/arrow/sparse_tensor.cc:459–483  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

457}
458
459Result<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

Callers

nothing calls this directly

Calls 6

format_idFunction · 0.85
NotImplementedFunction · 0.70

Tested by

no test coverage detected