diff --git a/paddle/fluid/operators/slice_op.h b/paddle/fluid/operators/slice_op.h index 96b8ea11d6845eb1b07cc05f1363ff34681d2071..658939a91f39a76db98398372ffb32538e9c668c 100644 --- a/paddle/fluid/operators/slice_op.h +++ b/paddle/fluid/operators/slice_op.h @@ -391,17 +391,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):