From 03ab040c5f46d6757cf907e4d44002758d52daf8 Mon Sep 17 00:00:00 2001 From: xiebaiyuan Date: Thu, 13 Sep 2018 13:46:55 +0800 Subject: [PATCH] suit multi inputs and out put . and fix bug when isInitialized check close #964 --- src/framework/operator.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/framework/operator.cpp b/src/framework/operator.cpp index ff706b8096..dd865fb27d 100644 --- a/src/framework/operator.cpp +++ b/src/framework/operator.cpp @@ -65,16 +65,20 @@ void OperatorBase::Run() const { auto var_vec_in = inputs_.at(key); for (int i = 0; i < var_vec_in.size(); ++i) { auto vari = scope_->FindVar(var_vec_in[i]); - Tensor *tensor = vari->template GetMutable(); - if (tensor) DLOG << type_ << " input- " << key << "=" << *tensor; + if (vari->IsInitialized()) { + Tensor *tensor = vari->template GetMutable(); + if (tensor) DLOG << type_ << " input- " << key << "=" << *tensor; + } } } for (const auto key : GetOutKeys()) { auto var_vec_out = outputs_.at(key); for (int i = 0; i < var_vec_out.size(); ++i) { auto vari = scope_->FindVar(var_vec_out[i]); - Tensor *tensor = vari->template GetMutable(); - if (tensor) DLOG << type_ << " output- " << key << "=" << *tensor; + if (vari->IsInitialized()) { + Tensor *tensor = vari->template GetMutable(); + if (tensor) DLOG << type_ << " output- " << key << "=" << *tensor; + } } } #endif -- GitLab