From d61c11764af1249c8acc6937f2c25a8ae6c86c3e Mon Sep 17 00:00:00 2001 From: tensor-tang Date: Wed, 12 Sep 2018 12:50:50 +0800 Subject: [PATCH] follow comment add enforce --- paddle/fluid/framework/operator.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/paddle/fluid/framework/operator.cc b/paddle/fluid/framework/operator.cc index bbd141cb3b..b7fae7171a 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; } -- GitLab