From 8759c78d8e9bd4e7361f0fbff8febc51a84709c5 Mon Sep 17 00:00:00 2001 From: WangZhen <23097963+0x45f@users.noreply.github.com> Date: Tue, 12 Jul 2022 19:19:33 +0800 Subject: [PATCH] Fix select input error when handle 0 dim Tensor (#44251) --- paddle/fluid/operators/assign_op.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/paddle/fluid/operators/assign_op.h b/paddle/fluid/operators/assign_op.h index e90de55bbbd..e6374eb3a66 100644 --- a/paddle/fluid/operators/assign_op.h +++ b/paddle/fluid/operators/assign_op.h @@ -71,7 +71,7 @@ class AssignFunctor { private: void copy_tensor(const framework::LoDTensor &lod_tensor, framework::LoDTensor *out) const { - if (lod_tensor.numel() == 0) return; + if (!lod_tensor.IsInitialized()) return; auto &out_tensor = *out; paddle::framework::TensorCopy(lod_tensor, lod_tensor.place(), &out_tensor); out_tensor.set_lod(lod_tensor.lod()); -- GitLab