|
|
@ -190,9 +190,23 @@ class MergeLoDTensorInferShape : public framework::InferShapeBase {
|
|
|
|
"MergeLoDTensorOp must has output Out");
|
|
|
|
"MergeLoDTensorOp must has output Out");
|
|
|
|
|
|
|
|
|
|
|
|
auto mask_dim = context->GetInputDim("Mask");
|
|
|
|
auto mask_dim = context->GetInputDim("Mask");
|
|
|
|
PADDLE_ENFORCE_EQ(mask_dim.size(), 2);
|
|
|
|
PADDLE_ENFORCE_EQ(mask_dim.size(), 2,
|
|
|
|
|
|
|
|
"If you are using IfElse OP:"
|
|
|
|
|
|
|
|
"\n\nie = fluid.layers.IfElse(cond=cond)\nwith "
|
|
|
|
|
|
|
|
"ie.true_block():\n out_1 = ie.input(x)\n\n"
|
|
|
|
|
|
|
|
"Please ensure that the cond should be a 2-D tensor and "
|
|
|
|
|
|
|
|
"the second dim size of cond should be 1. "
|
|
|
|
|
|
|
|
"But now the cond's shape is [",
|
|
|
|
|
|
|
|
*mask_dim.Get(), "].\n");
|
|
|
|
if (context->IsRuntime() || mask_dim[1] > 0) {
|
|
|
|
if (context->IsRuntime() || mask_dim[1] > 0) {
|
|
|
|
PADDLE_ENFORCE_EQ(mask_dim[1], 1);
|
|
|
|
PADDLE_ENFORCE_EQ(mask_dim[1], 1,
|
|
|
|
|
|
|
|
"If you are using IfElse OP:"
|
|
|
|
|
|
|
|
"\n\nie = fluid.layers.IfElse(cond=cond)\nwith "
|
|
|
|
|
|
|
|
"ie.true_block():\n out_1 = ie.input(x)\n\n"
|
|
|
|
|
|
|
|
"Please ensure that the cond should be a 2-D tensor "
|
|
|
|
|
|
|
|
"and the second dim size of cond should be 1. "
|
|
|
|
|
|
|
|
"But now the cond's shape is [",
|
|
|
|
|
|
|
|
*mask_dim.Get(), "].\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
context->SetOutputDim("Out", context->GetInputDim("InTrue"));
|
|
|
|
context->SetOutputDim("Out", context->GetInputDim("InTrue"));
|
|
|
|