| 233 | } |
| 234 | |
| 235 | Status 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 | |
| 255 | template <typename Out> |
| 256 | struct ConvertArrayToTensorVisitor { |
no test coverage detected