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

Function ValidateTensorParameters

cpp/src/arrow/tensor.cc:235–253  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

233}
234
235Status ValidateTensorParameters(const std::shared_ptr<DataType>& type,
236 const std::shared_ptr<Buffer>& data,
237 const std::vector<int64_t>& shape,
238 const std::vector<int64_t>& strides,
239 const std::vector<std::string>& dim_names) {
240 RETURN_NOT_OK(CheckTensorValidity(type, data, shape));
241 if (!strides.empty()) {
242 RETURN_NOT_OK(CheckTensorStridesValidity(data, shape, strides, type));
243 } else {
244 std::vector<int64_t> tmp_strides;
245 RETURN_NOT_OK(ComputeRowMajorStrides(checked_cast<const FixedWidthType&>(*type),
246 shape, &tmp_strides));
247 RETURN_NOT_OK(CheckTensorStridesValidity(data, shape, tmp_strides, type));
248 }
249 if (dim_names.size() > shape.size()) {
250 return Status::Invalid("too many dim_names are supplied");
251 }
252 return Status::OK();
253}
254
255template <typename Out>
256struct ConvertArrayToTensorVisitor {

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