diff --git a/paddle/fluid/framework/operator.cc b/paddle/fluid/framework/operator.cc index bbd141cb3baa3095a5401e96819c2d4009d3aaa8..b7fae7171a57666a8fb4613a7cbe3aa15997b638 100644 --- a/paddle/fluid/framework/operator.cc +++ b/paddle/fluid/framework/operator.cc @@ -471,10 +471,11 @@ class RuntimeInferShapeContext : public InferShapeContext { return false; } const auto& in = it->second; - - if (in.size() != 1 || in[0] == kEmptyVarName) { + if (in.size() == 0 || in[0] == kEmptyVarName) { return false; } + PADDLE_ENFORCE_EQ(in.size(), 1UL, + "Input %s should not have more than one inputs", name); return scope_.FindVar(in[0]) != nullptr; } @@ -486,9 +487,11 @@ class RuntimeInferShapeContext : public InferShapeContext { return false; } const auto& out = it->second; - if (out.size() != 1 || out[0] == kEmptyVarName) { + if (out.size() == 0 || out[0] == kEmptyVarName) { return false; } + PADDLE_ENFORCE_EQ(out.size(), 1UL, + "Output %s should not have more than one outputs", name); return scope_.FindVar(out[0]) != nullptr; }