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

Function GetSparseTensorBodyBufferCount

cpp/src/arrow/ipc/reader.cc:2469–2487  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2467namespace {
2468
2469Result<size_t> GetSparseTensorBodyBufferCount(SparseTensorFormat::type format_id,
2470 const size_t ndim) {
2471 switch (format_id) {
2472 case SparseTensorFormat::COO:
2473 return 2;
2474
2475 case SparseTensorFormat::CSR:
2476 return 3;
2477
2478 case SparseTensorFormat::CSC:
2479 return 3;
2480
2481 case SparseTensorFormat::CSF:
2482 return 2 * ndim;
2483
2484 default:
2485 return Status::Invalid("Unrecognized sparse tensor format");
2486 }
2487}
2488
2489Status CheckSparseTensorBodyBufferCount(const IpcPayload& payload,
2490 SparseTensorFormat::type sparse_tensor_format_id,

Calls 1

InvalidFunction · 0.50

Tested by

no test coverage detected