diff --git a/paddle/fluid/operators/slice_op.h b/paddle/fluid/operators/slice_op.h index 22f6fa9e3e6f206b33c46369086d1637fdc83457..faa1d1237dd1ddd7124dd37c917b131037651502 100644 --- a/paddle/fluid/operators/slice_op.h +++ b/paddle/fluid/operators/slice_op.h @@ -468,17 +468,7 @@ class SliceGradKernel : public framework::OpKernel { } } - if (need_pad_num == 0) { - // do not need padding, pass if data address same, else copy - if (d_input->mutable_data(context.GetPlace()) == d_out->data()) { - // inplace, do not any operator, pass - } else { - framework::TensorCopy( - *d_out, context.GetPlace(), - context.template device_context(), - d_input); - } - } else if (need_pad_num == 1) { + if (need_pad_num == 1) { // only need padding one dimension, we can reduce dimension. // only the padding dimension is available for us. // How to reduce dimension(5 to 3 for example):