提交 ecc52688 编写于 作者: A Adam 提交者: Tao Luo

Preserve shape in inplace operators (#22369)

上级 7d02b009
......@@ -1086,7 +1086,9 @@ void OperatorWithKernel::TransferInplaceVarsBack(
PADDLE_ENFORCE_NOT_NULL(var, "The var[%s] should not be nullptr.",
var_name);
auto* transformed_tensor = GetLoDTensorOrSelectedRowsValueFromVar(*var);
auto original_dims = original_tensor->dims();
original_tensor->ShareDataWith(*transformed_tensor);
original_tensor->Resize(original_dims);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册