| 65 | } |
| 66 | |
| 67 | Status IsPermutationValid(std::span<const int64_t> permutation) { |
| 68 | const auto size = static_cast<int64_t>(permutation.size()); |
| 69 | std::vector<uint8_t> dim_seen(size, 0); |
| 70 | |
| 71 | for (const auto p : permutation) { |
| 72 | if (p < 0 || p >= size || dim_seen[p] != 0) { |
| 73 | return Status::Invalid( |
| 74 | "Permutation indices for ", size, |
| 75 | " dimensional tensors must be unique and within [0, ", size - 1, |
| 76 | "] range. Got: ", ::arrow::internal::PrintVector{permutation, ","}); |
| 77 | } |
| 78 | dim_seen[p] = 1; |
| 79 | } |
| 80 | return Status::OK(); |
| 81 | } |
| 82 | |
| 83 | Result<std::vector<int64_t>> ComputeStrides(const std::shared_ptr<DataType>& value_type, |
| 84 | std::span<const int64_t> shape, |
no test coverage detected