Skip to content

Commit d8e238d

Browse files
authored
solve slice inplace illegal memory address bug (#34265)
1 parent d953f8a commit d8e238d

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

paddle/fluid/operators/slice_op.h

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -391,17 +391,7 @@ class SliceGradKernel : public framework::OpKernel<T> {
391391
}
392392
}
393393

394-
if (need_pad_num == 0) {
395-
// do not need padding, pass if data address same, else copy
396-
if (d_input->mutable_data<T>(context.GetPlace()) == d_out->data<T>()) {
397-
// inplace, do not any operator, pass
398-
} else {
399-
framework::TensorCopy(
400-
*d_out, context.GetPlace(),
401-
context.template device_context<platform::DeviceContext>(),
402-
d_input);
403-
}
404-
} else if (need_pad_num == 1) {
394+
if (need_pad_num == 1) {
405395
// only need padding one dimension, we can reduce dimension.
406396
// only the padding dimension is available for us.
407397
// How to reduce dimension(5 to 3 for example):

0 commit comments

Comments
 (0)