未验证 提交 a615002a 编写于 作者: Y YuanRisheng 提交者: GitHub

Fix bugs that copy occurs when tensor "in" and tensor "out" is same in reshape kernel (#38249)

* fix bugs when run reshape

* fix ci bug
上级 06128b9f
...@@ -392,7 +392,9 @@ class ReshapeKernel { ...@@ -392,7 +392,9 @@ class ReshapeKernel {
ctx.GetPlace()), ctx.GetPlace()),
std::move(meta)); std::move(meta));
pten::DenseTensor *pt_out = nullptr; pten::DenseTensor *pt_out = nullptr;
if (in == out) { if (in != nullptr && out != nullptr && in->Holder() != nullptr &&
out->Holder() != nullptr &&
in->Holder()->ptr() == out->Holder()->ptr()) {
pt_out = pt_x.get(); pt_out = pt_x.get();
} else { } else {
pt_out = pt_out_tmp.get(); pt_out = pt_out_tmp.get();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册