Skip to content

Commit e52df0b

Browse files
lucylqfacebook-github-bot
authored andcommitted
Check slice scatter args for each dim (#15628)
Summary: Not sure why we are missing a check on the last dim, add it back in. Reviewed By: JacobSzwejbka Differential Revision: D86368348
1 parent d4a9a4d commit e52df0b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kernels/portable/cpu/util/slice_util.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ bool check_slice_scatter_args(
8181
Tensor output) {
8282
ET_LOG_AND_RETURN_IF_FALSE(input.dim() > 0);
8383

84-
// Check dim. The dim planed to be selected on shall exist in input
84+
// Check dim. The dim planned to be selected on shall exist in input
8585
ET_LOG_AND_RETURN_IF_FALSE(dim_is_valid(dim, input.dim()));
8686

8787
// Input and output tensors should be the same shape and dtype
@@ -97,7 +97,7 @@ bool check_slice_scatter_args(
9797
// The size of src tensor should follow these rules:
9898
// - src.size(i) shall equal to input.size(i) if i != dim,
9999
// - src.size(dim) shall equal to num_values
100-
for (const auto d : c10::irange(input.dim() - 1)) {
100+
for (const auto d : c10::irange(input.dim())) {
101101
if (d != dim) {
102102
ET_LOG_AND_RETURN_IF_FALSE(
103103
tensors_have_same_size_at_dims(input, d, src, d));

0 commit comments

Comments
 (0)