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

Function ValidateTensorParameters

cpp/src/arrow/tensor.cc:207–224  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

205}
206
207Status ValidateTensorParameters(const std::shared_ptr<DataType>& type,
208 const std::shared_ptr<Buffer>& data,
209 const std::vector<int64_t>& shape,
210 const std::vector<int64_t>& strides,
211 const std::vector<std::string>& dim_names) {
212 RETURN_NOT_OK(CheckTensorValidity(type, data, shape));
213 if (!strides.empty()) {
214 RETURN_NOT_OK(CheckTensorStridesValidity(data, shape, strides, type));
215 } else {
216 std::vector<int64_t> tmp_strides;
217 RETURN_NOT_OK(ComputeRowMajorStrides(checked_cast<const FixedWidthType&>(*type),
218 shape, &tmp_strides));
219 }
220 if (dim_names.size() > shape.size()) {
221 return Status::Invalid("too many dim_names are supplied");
222 }
223 return Status::OK();
224}
225
226template <typename Out>
227struct ConvertColumnsToTensorVisitor {

Callers 3

tensor.hFile · 0.85
ValidateFunction · 0.85
MakeMethod · 0.85

Calls 7

CheckTensorValidityFunction · 0.85
ComputeRowMajorStridesFunction · 0.85
InvalidFunction · 0.70
OKFunction · 0.70
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected