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

Function MakeSparseTensorIndexCOO

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

Source from the content-addressed store, hash-verified

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