From bbe648dffb4848041690d71d27d5aef19f31a3a0 Mon Sep 17 00:00:00 2001 From: Yinghai Lu Date: Thu, 11 Apr 2019 12:28:32 -0700 Subject: [PATCH] Allow empty net type (#19154) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/19154 I recently saw some weird workflow error due to empty but set net_type. Maybe we should just fallback to simple net in this case. Reviewed By: dzhulgakov Differential Revision: D14890072 fbshipit-source-id: 4e9edf8232298000713bebb0bfdec61e9c5df17d --- caffe2/core/net.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/caffe2/core/net.cc b/caffe2/core/net.cc index 54ca39d..7e4c6e5 100644 --- a/caffe2/core/net.cc +++ b/caffe2/core/net.cc @@ -157,7 +157,7 @@ unique_ptr CreateNet( const std::shared_ptr& net_def, Workspace* ws) { std::string net_type; - if (net_def->has_type()) { + if (net_def->has_type() && !net_def->type().empty()) { net_type = net_def->type(); } else { // By default, we will return a simple network that just runs all operators -- 2.7.4