From 0cc984bdb258059482dbed4d8bce06eebf7f6bcf Mon Sep 17 00:00:00 2001 From: Tao Luo Date: Tue, 16 Apr 2019 10:12:12 +0800 Subject: [PATCH] Merge pull request #16852 from sneaxiy/fix_merge_lod_tensor_op_infer_shape Fix merge_lod_tensor_op infer shape --- paddle/fluid/operators/merge_lod_tensor_op.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/paddle/fluid/operators/merge_lod_tensor_op.cc b/paddle/fluid/operators/merge_lod_tensor_op.cc index da7fa1b81..5edc233f6 100644 --- a/paddle/fluid/operators/merge_lod_tensor_op.cc +++ b/paddle/fluid/operators/merge_lod_tensor_op.cc @@ -164,7 +164,9 @@ class MergeLoDTensorInferShape : public framework::InferShapeBase { auto mask_dim = context->GetInputDim("Mask"); PADDLE_ENFORCE_EQ(mask_dim.size(), 2); - PADDLE_ENFORCE_EQ(mask_dim[1], 1); + if (context->IsRuntime() || mask_dim[1] > 0) { + PADDLE_ENFORCE_EQ(mask_dim[1], 1); + } context->SetOutputDim("Out", context->GetInputDim("InTrue")); } -- GitLab