未验证 提交 d8e238d1 编写于 作者: J jiangcheng 提交者: GitHub

solve slice inplace illegal memory address bug (#34265)

上级 d953f8a9
...@@ -391,17 +391,7 @@ class SliceGradKernel : public framework::OpKernel<T> { ...@@ -391,17 +391,7 @@ class SliceGradKernel : public framework::OpKernel<T> {
} }
} }
if (need_pad_num == 0) { if (need_pad_num == 1) {
// do not need padding, pass if data address same, else copy
if (d_input->mutable_data<T>(context.GetPlace()) == d_out->data<T>()) {
// inplace, do not any operator, pass
} else {
framework::TensorCopy(
*d_out, context.GetPlace(),
context.template device_context<platform::DeviceContext>(),
d_input);
}
} else if (need_pad_num == 1) {
// only need padding one dimension, we can reduce dimension. // only need padding one dimension, we can reduce dimension.
// only the padding dimension is available for us. // only the padding dimension is available for us.
// How to reduce dimension(5 to 3 for example): // How to reduce dimension(5 to 3 for example):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册