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

Function MakeSparseTensorIndex

cpp/src/arrow/ipc/metadata_internal.cc:1205–1243  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1203}
1204
1205Status MakeSparseTensorIndex(FBB& fbb, const SparseIndex& sparse_index,
1206 const std::vector<BufferMetadata>& buffers,
1207 flatbuf::SparseTensorIndex* fb_sparse_index_type,
1208 Offset* fb_sparse_index, size_t* num_buffers) {
1209 switch (sparse_index.format_id()) {
1210 case SparseTensorFormat::COO:
1211 RETURN_NOT_OK(MakeSparseTensorIndexCOO(
1212 fbb, checked_cast<const SparseCOOIndex&>(sparse_index), buffers,
1213 fb_sparse_index_type, fb_sparse_index, num_buffers));
1214 break;
1215
1216 case SparseTensorFormat::CSR:
1217 RETURN_NOT_OK(MakeSparseMatrixIndexCSX(
1218 fbb, checked_cast<const SparseCSRIndex&>(sparse_index), buffers,
1219 fb_sparse_index_type, fb_sparse_index, num_buffers));
1220 break;
1221
1222 case SparseTensorFormat::CSC:
1223 RETURN_NOT_OK(MakeSparseMatrixIndexCSX(
1224 fbb, checked_cast<const SparseCSCIndex&>(sparse_index), buffers,
1225 fb_sparse_index_type, fb_sparse_index, num_buffers));
1226 break;
1227
1228 case SparseTensorFormat::CSF:
1229 RETURN_NOT_OK(MakeSparseTensorIndexCSF(
1230 fbb, checked_cast<const SparseCSFIndex&>(sparse_index), buffers,
1231 fb_sparse_index_type, fb_sparse_index, num_buffers));
1232 break;
1233
1234 default:
1235 *fb_sparse_index_type =
1236 flatbuf::SparseTensorIndex::SparseTensorIndex_NONE; // Silence warnings
1237 std::stringstream ss;
1238 ss << "Unsupported sparse tensor format:: " << sparse_index.ToString() << std::endl;
1239 return Status::NotImplemented(ss.str());
1240 }
1241
1242 return Status::OK();
1243}
1244
1245Status MakeSparseTensor(FBB& fbb, const SparseTensor& sparse_tensor, int64_t body_length,
1246 const std::vector<BufferMetadata>& buffers,

Callers 1

MakeSparseTensorFunction · 0.85

Calls 7

MakeSparseTensorIndexCOOFunction · 0.85
MakeSparseMatrixIndexCSXFunction · 0.85
MakeSparseTensorIndexCSFFunction · 0.85
strMethod · 0.80
NotImplementedFunction · 0.50
OKFunction · 0.50
ToStringMethod · 0.45

Tested by

no test coverage detected