This is an automated email from the ASF dual-hosted git repository. wangwei pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-singa.git
commit f506ef269ed90556924434925f6c886789976f23 Author: xuewanqi <[email protected]> AuthorDate: Fri Nov 30 08:39:43 2018 +0000 SINGA-411 Local variable 'params' referenced before assignment - try to fix bug. --- python/singa/net.py | 2 +- src/io/snapshot.cc | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/python/singa/net.py b/python/singa/net.py index e30b075..561a6cb 100755 --- a/python/singa/net.py +++ b/python/singa/net.py @@ -472,7 +472,7 @@ class FeedForwardNet(object): f = f[0:-4] sp = snapshot.Snapshot(f, True, buffer_size) #v = tensor.from_numpy(np.array([__version__])) - #sp.write(b'SINGA_VERSION', v) + #sp.write('SINGA_VERSION', v) for (name, val) in zip(self.param_names(), self.param_values()): val.to_host() sp.write(name, val) diff --git a/src/io/snapshot.cc b/src/io/snapshot.cc old mode 100644 new mode 100755 index d24513e..a95f2c7 --- a/src/io/snapshot.cc +++ b/src/io/snapshot.cc @@ -48,7 +48,7 @@ Snapshot::Snapshot(const std::string& prefix, Mode mode, int max_param_size /*in text_reader_ptr->Open(prefix + ".desc"); std::string key, val; while (text_reader_ptr->Read(&key, &val)) { - if (key == "SINGA_VERSION") + if (key == "0") version_ = std::stoi(val); } delete text_reader_ptr; @@ -59,11 +59,13 @@ Snapshot::Snapshot(const std::string& prefix, Mode mode, int max_param_size /*in <<" or " << prefix + " .model (used by 1.0.0)"; singa::TensorProto tp; while (bin_reader_ptr_->Read(&key, &val)) { + /* if (key == "SINGA_VERSION") { CHECK(version_ == std::stoi(val)) << key << " in .bin and .desc mismatch: " << val << " (bin) vs " << version_ << " (desc)"; continue; } + */ CHECK(param_names_.count(key) == 0); param_names_.insert(key);
