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

Method Make

cpp/src/arrow/sparse_tensor.h:563–577  ·  view source on GitHub ↗

\brief Create a SparseTensor with full parameters

Source from the content-addressed store, hash-verified

561
562 /// \brief Create a SparseTensor with full parameters
563 static inline Result<std::shared_ptr<SparseTensorImpl<SparseIndexType>>> Make(
564 const std::shared_ptr<SparseIndexType>& sparse_index,
565 const std::shared_ptr<DataType>& type, const std::shared_ptr<Buffer>& data,
566 const std::vector<int64_t>& shape, const std::vector<std::string>& dim_names) {
567 if (!is_tensor_supported(type->id())) {
568 return Status::Invalid(type->ToString(),
569 " is not valid data type for a sparse tensor");
570 }
571 ARROW_RETURN_NOT_OK(sparse_index->ValidateShape(shape));
572 if (dim_names.size() > 0 && dim_names.size() != shape.size()) {
573 return Status::Invalid("dim_names length is inconsistent with shape");
574 }
575 return std::make_shared<SparseTensorImpl<SparseIndexType>>(sparse_index, type, data,
576 shape, dim_names);
577 }
578
579 /// \brief Create a sparse tensor from a dense tensor
580 ///

Callers

nothing calls this directly

Calls 11

is_tensor_supportedFunction · 0.85
default_memory_poolFunction · 0.85
InvalidFunction · 0.70
MakeFunction · 0.70
idMethod · 0.45
ToStringMethod · 0.45
ValidateShapeMethod · 0.45
sizeMethod · 0.45
typeMethod · 0.45
shapeMethod · 0.45

Tested by

no test coverage detected