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

[Cherry-pick] solve slice inplace illegal memory address bug (#34265) #34473

SliceGradKernel的need_pad_num == 0判断有问题,直接跳过导致没有分配合适的空间,删去该判断逻辑后运行就正常了。
上级 384372f5
......@@ -468,17 +468,7 @@ class SliceGradKernel : public framework::OpKernel<T> {
}
}
if (need_pad_num == 0) {
// 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) {
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):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册