Skip to content

Commit d61c117

Browse files
committed
follow comment add enforce
1 parent 43d3054 commit d61c117

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

paddle/fluid/framework/operator.cc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -471,10 +471,11 @@ class RuntimeInferShapeContext : public InferShapeContext {
471471
return false;
472472
}
473473
const auto& in = it->second;
474-
475-
if (in.size() != 1 || in[0] == kEmptyVarName) {
474+
if (in.size() == 0 || in[0] == kEmptyVarName) {
476475
return false;
477476
}
477+
PADDLE_ENFORCE_EQ(in.size(), 1UL,
478+
"Input %s should not have more than one inputs", name);
478479
return scope_.FindVar(in[0]) != nullptr;
479480
}
480481

@@ -486,9 +487,11 @@ class RuntimeInferShapeContext : public InferShapeContext {
486487
return false;
487488
}
488489
const auto& out = it->second;
489-
if (out.size() != 1 || out[0] == kEmptyVarName) {
490+
if (out.size() == 0 || out[0] == kEmptyVarName) {
490491
return false;
491492
}
493+
PADDLE_ENFORCE_EQ(out.size(), 1UL,
494+
"Output %s should not have more than one outputs", name);
492495
return scope_.FindVar(out[0]) != nullptr;
493496
}
494497

0 commit comments

Comments
 (0)