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