From ba140222d63eb8a9c138da8525b5eb0be994aaa0 Mon Sep 17 00:00:00 2001 From: GaoWei8 <53294385+GaoWei8@users.noreply.github.com> Date: Tue, 25 Feb 2020 11:40:27 +0800 Subject: [PATCH] fix compile&runtime lod_equality of lod_reset (#22737) --- paddle/fluid/operators/lod_reset_op.cc | 14 ++++++++++++++ .../white_list/compile_vs_runtime_white_list.py | 1 - 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/paddle/fluid/operators/lod_reset_op.cc b/paddle/fluid/operators/lod_reset_op.cc index e003c7f150d..4ad1fbae2c0 100644 --- a/paddle/fluid/operators/lod_reset_op.cc +++ b/paddle/fluid/operators/lod_reset_op.cc @@ -41,6 +41,20 @@ class LoDResetOp : public framework::OperatorWithKernel { if (append) { ctx->ShareLoD("X", /*->*/ "Out"); } + + if (ctx->HasInput("Y")) { + if (!ctx->IsRuntime()) { + ctx->SetLoDLevel("Out", std::max(ctx->GetLoDLevel("Y"), 1)); + } + } else if (append) { + if (!ctx->IsRuntime()) { + ctx->SetLoDLevel("Out", std::max(ctx->GetLoDLevel("X") + 1, 1)); + } + } else { + if (!ctx->IsRuntime()) { + ctx->SetLoDLevel("Out", 1); + } + } ctx->SetOutputDim("Out", ctx->GetInputDim("X")); } diff --git a/python/paddle/fluid/tests/unittests/white_list/compile_vs_runtime_white_list.py b/python/paddle/fluid/tests/unittests/white_list/compile_vs_runtime_white_list.py index ed7788443a6..da906f2c0e7 100644 --- a/python/paddle/fluid/tests/unittests/white_list/compile_vs_runtime_white_list.py +++ b/python/paddle/fluid/tests/unittests/white_list/compile_vs_runtime_white_list.py @@ -19,7 +19,6 @@ # reasons for skipping compile_vs_runtime test or be fixed later. COMPILE_RUN_OP_WHITE_LIST = [ - 'lod_reset', \ 'sequence_pool', \ 'sequence_slice', \ 'generate_mask_labels', \ -- GitLab