Skip to content

Commit

Permalink
permutation test
Browse files Browse the repository at this point in the history
  • Loading branch information
rok committed Dec 13, 2023
1 parent 9c60b85 commit 6f3d756
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cpp/src/arrow/extension/fixed_shape_tensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,12 @@ Result<std::shared_ptr<DataType>> FixedShapeTensorType::Make(
return Status::Invalid("dim_names size must match shape size. Expected: ",
shape.size(), " Got: ", dim_names.size());
}
for (auto i : permutation) {
if (i < 0 || i >= static_cast<int64_t>(shape.size())) {
return Status::Invalid("permutation indices must be in [0, shape.size()). Got: ",
i);
}
}
const auto size = std::accumulate(shape.begin(), shape.end(), static_cast<int64_t>(1),
std::multiplies<>());
return std::make_shared<FixedShapeTensorType>(value_type, static_cast<int32_t>(size),
Expand Down

0 comments on commit 6f3d756

Please sign in to comment.