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

Method Make

cpp/src/arrow/sparse_tensor.h:569–583  ·  view source on GitHub ↗

\brief Create a SparseTensor with full parameters

Source from the content-addressed store, hash-verified

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

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