Skip to content

Commit

Permalink
fix bug of infer shape for slice (PaddlePaddle#43443)
Browse files Browse the repository at this point in the history
  • Loading branch information
zyfncg committed Jun 14, 2022
1 parent efb6fa7 commit dcdcbb6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion paddle/fluid/operators/slice_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,11 @@ class SliceOp : public framework::OperatorWithKernel {
platform::errors::InvalidArgument(
"The size of ends must be equal to the size of axes."));
}

for (auto &axis : axes) {
if (axis < 0) {
axis = std::max(0, axis + in_dims.size());
}
}
phi::funcs::CheckAndUpdateSliceAttrs<int>(in_dims, axes, &starts, &ends,
nullptr, &infer_flags);

Expand Down

0 comments on commit dcdcbb6

Please sign in to comment.