File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
paddle/fluid/operators/controlflow Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -71,8 +71,16 @@ class BinaryLogicalOpInferShape : public framework::InferShapeBase {
71
71
" Input(Y) of %s operator must not be null" , comment.type );
72
72
auto dim_x = context->GetInputDim (" X" );
73
73
auto dim_y = context->GetInputDim (" Y" );
74
- PADDLE_ENFORCE_EQ (framework::product (dim_x), framework::product (dim_y),
75
- " The number of elements in X and Y should be same" );
74
+
75
+ int product_x = framework::product (dim_x);
76
+ int product_y = framework::product (dim_y);
77
+ bool check = context->IsRuntime () || (product_x >= 0 && product_y >= 0 );
78
+ if (check) {
79
+ PADDLE_ENFORCE_EQ (
80
+ product_x, product_y,
81
+ " The number of elements in X and Y should be same, %d != %d" ,
82
+ product_x, product_y);
83
+ }
76
84
77
85
context->SetOutputDim (" Out" , context->GetInputDim (" X" ));
78
86
context->ShareLoD (" X" , " Out" );
You can’t perform that action at this time.
0 commit comments