From 2d65ecef8edeb3b6a854ec8c803c5dae17e82815 Mon Sep 17 00:00:00 2001 From: Naren Dasan Date: Sun, 3 May 2020 20:54:48 -0700 Subject: [PATCH] fix(//core/conversion/conversionctx): Check both tensor and eval maps before throwing conversion warning Signed-off-by: Naren Dasan Signed-off-by: Naren Dasan --- core/conversion/conversionctx/ConversionCtx.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/core/conversion/conversionctx/ConversionCtx.cpp b/core/conversion/conversionctx/ConversionCtx.cpp index acde8024c3..7037e9a512 100644 --- a/core/conversion/conversionctx/ConversionCtx.cpp +++ b/core/conversion/conversionctx/ConversionCtx.cpp @@ -118,10 +118,13 @@ std::string ConversionCtx::SerializeEngine() { bool ConversionCtx::CheckLayerAddition(const torch::jit::Node* n) { for (auto out : n->outputs()) { - auto iter = this->value_tensor_map.find(out); - if (iter == this->value_tensor_map.end()) { - LOG_WARNING("Node " << util::node_info(n) << " output: " << out->debugName() << " does not have a coresponding output, may potentially indicate a defective converter"); - return false; + auto iter_t = this->value_tensor_map.find(out); + if (iter_t == this->value_tensor_map.end()) { + auto iter_iv = this->evaluated_value_map.find(out); + if (iter_iv == this->evaluated_value_map.end()) { + LOG_WARNING("Node " << util::node_info(n) << " output: " << out->debugName() << " does not have a coresponding value or tensor, may potentially indicate a defective evaluator or converter"); + return false; + } } } return true;