diff --git a/paddle/fluid/operators/lod_reset_op.cc b/paddle/fluid/operators/lod_reset_op.cc index e003c7f150dcc219a214bc2ef2630e5dfbd1e7a8..4ad1fbae2c078a71b9f3c902c9de7c3bb5e6fc47 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 ed7788443a6a18ec20e98c28957296d760530ace..da906f2c0e7e832d106b5a52bae84caaa447db63 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', \