From 19511dfa25a03dafaea8743eff5bc4526ffb0a03 Mon Sep 17 00:00:00 2001 From: liym27 <33742067+liym27@users.noreply.github.com> Date: Thu, 30 Apr 2020 10:15:43 +0800 Subject: [PATCH] Fix bug in assign op: support to infer shape for LOD_TENSOR_ARRAY. (#24268) --- paddle/fluid/operators/assign_op.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/paddle/fluid/operators/assign_op.cc b/paddle/fluid/operators/assign_op.cc index d6ab77b6cb8..cb47511796c 100644 --- a/paddle/fluid/operators/assign_op.cc +++ b/paddle/fluid/operators/assign_op.cc @@ -36,6 +36,13 @@ class AssignOp : public framework::OperatorWithKernel { if (type == framework::proto::VarType::LOD_TENSOR) { ctx->ShareLoD("X", /*->*/ "Out"); } + } else if (type == framework::proto::VarType::LOD_TENSOR_ARRAY) { + if (ctx->IsRuntime()) { + // The runtime output shape is determined in kernel. + return; + } else { + ctx->SetOutputDim("Out", ctx->GetInputDim("X")); + } } } } -- GitLab