diff --git a/src/framework/operator.cpp b/src/framework/operator.cpp index ff706b80964b426d455842699c4dcb511dcfa5b0..dd865fb27d4345f16ddca8005463986787d681be 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