From e52df0bcb3dc4e16dab0c9d769e0c0174b7fe44b Mon Sep 17 00:00:00 2001 From: Lucy Qiu Date: Tue, 11 Nov 2025 10:49:02 -0800 Subject: [PATCH] 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 --- kernels/portable/cpu/util/slice_util.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernels/portable/cpu/util/slice_util.cpp b/kernels/portable/cpu/util/slice_util.cpp index 909bd827d79..6a0f63b31ba 100644 --- a/kernels/portable/cpu/util/slice_util.cpp +++ b/kernels/portable/cpu/util/slice_util.cpp @@ -81,7 +81,7 @@ bool check_slice_scatter_args( Tensor output) { ET_LOG_AND_RETURN_IF_FALSE(input.dim() > 0); - // Check dim. The dim planed to be selected on shall exist in input + // Check dim. The dim planned to be selected on shall exist in input ET_LOG_AND_RETURN_IF_FALSE(dim_is_valid(dim, input.dim())); // Input and output tensors should be the same shape and dtype @@ -97,7 +97,7 @@ bool check_slice_scatter_args( // The size of src tensor should follow these rules: // - src.size(i) shall equal to input.size(i) if i != dim, // - src.size(dim) shall equal to num_values - for (const auto d : c10::irange(input.dim() - 1)) { + for (const auto d : c10::irange(input.dim())) { if (d != dim) { ET_LOG_AND_RETURN_IF_FALSE( tensors_have_same_size_at_dims(input, d, src, d));