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

Function MakeSparseTensorIndexCOO

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

Source from the content-addressed store, hash-verified

1067}
1068
1069Status MakeSparseTensorIndexCOO(FBB& fbb, const SparseCOOIndex& sparse_index,
1070 const std::vector<BufferMetadata>& buffers,
1071 flatbuf::SparseTensorIndex* fb_sparse_index_type,
1072 Offset* fb_sparse_index, size_t* num_buffers) {
1073 *fb_sparse_index_type =
1074 flatbuf::SparseTensorIndex::SparseTensorIndex_SparseTensorIndexCOO;
1075
1076 // We assume that the value type of indices tensor is an integer.
1077 const auto& index_value_type =
1078 checked_cast<const IntegerType&>(*sparse_index.indices()->type());
1079 auto indices_type_offset =
1080 flatbuf::CreateInt(fbb, index_value_type.bit_width(), index_value_type.is_signed());
1081
1082 auto fb_strides = fbb.CreateVector(sparse_index.indices()->strides().data(),
1083 sparse_index.indices()->strides().size());
1084
1085 const BufferMetadata& indices_metadata = buffers[0];
1086 flatbuf::Buffer indices(indices_metadata.offset, indices_metadata.length);
1087
1088 *fb_sparse_index =
1089 flatbuf::CreateSparseTensorIndexCOO(fbb, indices_type_offset, fb_strides, &indices,
1090 sparse_index.is_canonical())
1091 .Union();
1092 *num_buffers = 1;
1093 return Status::OK();
1094}
1095
1096template <typename SparseIndexType>
1097struct SparseMatrixCompressedAxis {};

Callers 1

MakeSparseTensorIndexFunction · 0.85

Calls 10

CreateIntFunction · 0.85
indicesMethod · 0.80
stridesMethod · 0.80
OKFunction · 0.50
typeMethod · 0.45
bit_widthMethod · 0.45
is_signedMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected