From dca68cdf97c8408313aa461b968e1830016d70f2 Mon Sep 17 00:00:00 2001 From: tensor-tang Date: Fri, 28 Dec 2018 16:05:23 +0000 Subject: [PATCH] throw error when name not find test=develop --- paddle/fluid/inference/api/analysis_predictor.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/paddle/fluid/inference/api/analysis_predictor.cc b/paddle/fluid/inference/api/analysis_predictor.cc index 6e3c0aa1e1..5aceea7d01 100644 --- a/paddle/fluid/inference/api/analysis_predictor.cc +++ b/paddle/fluid/inference/api/analysis_predictor.cc @@ -251,7 +251,12 @@ bool AnalysisPredictor::SetFeed(const std::vector &inputs, input.set_lod(lod); int idx = -1; if (config_.specify_input_name) { - idx = feed_names_.at(inputs[i].name); + auto name = inputs[i].name; + if (feed_names_.find(name) == feed_names_.end()) { + LOG(ERROR) << "feed names from program do not have name: " << name + << " from specified input"; + } + idx = feed_names_[name]; } else { idx = boost::get(feeds_[i]->GetAttr("col")); } -- GitLab