You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@singa.apache.org by wa...@apache.org on 2018/12/03 02:55:36 UTC
[incubator-singa] branch master updated (e1b3975 -> 73f9637)
This is an automated email from the ASF dual-hosted git repository.
wangwei pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-singa.git.
from e1b3975 SINGA-411 Local variable 'params' referenced before assignment
new 7470b20 SINGA-411 Local variable 'params' referenced before assignment
new f506ef2 SINGA-411 Local variable 'params' referenced before assignment
new 73f9637 SINGA-411 Local variable 'params' referenced before assignment
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
src/io/snapshot.cc | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
mode change 100644 => 100755 src/io/snapshot.cc
[incubator-singa] 03/03: SINGA-411 Local variable 'params'
referenced before assignment
Posted by wa...@apache.org.
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 73f963727cf8bd1bfe6e8ec65cd1fedda35cf8fc
Author: xuewanqi <xu...@outlook.com>
AuthorDate: Sat Dec 1 09:38:48 2018 +0000
SINGA-411 Local variable 'params' referenced before assignment
- fix bug.
---
python/singa/net.py | 4 ++--
src/io/snapshot.cc | 9 +++++++--
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/python/singa/net.py b/python/singa/net.py
index 561a6cb..e92d560 100755
--- a/python/singa/net.py
+++ b/python/singa/net.py
@@ -471,8 +471,8 @@ class FeedForwardNet(object):
if f.endswith('.bin'):
f = f[0:-4]
sp = snapshot.Snapshot(f, True, buffer_size)
- #v = tensor.from_numpy(np.array([__version__]))
- #sp.write('SINGA_VERSION', v)
+ v = tensor.from_numpy(np.array([__version__]))
+ 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
index a95f2c7..86c5ccd 100755
--- a/src/io/snapshot.cc
+++ b/src/io/snapshot.cc
@@ -42,8 +42,11 @@ Snapshot::Snapshot(const std::string& prefix, Mode mode, int max_param_size /*in
text_writer_ptr_->Open(prefix + ".desc", io::kCreate);
// write the current version ids
- text_writer_ptr_->Write("SINGA_VERSION", std::to_string(SINGA_VERSION));
+ //text_writer_ptr_->Write("SINGA_VERSION", std::to_string(SINGA_VERSION));
+ text_writer_ptr_->Write("", "SINGA VERSION: " + std::to_string(SINGA_VERSION));
} else if (mode == kRead) {
+
+ /*
auto text_reader_ptr = new io::TextFileReader();
text_reader_ptr->Open(prefix + ".desc");
std::string key, val;
@@ -52,7 +55,8 @@ Snapshot::Snapshot(const std::string& prefix, Mode mode, int max_param_size /*in
version_ = std::stoi(val);
}
delete text_reader_ptr;
-
+ */
+ std::string key, val;
if (!bin_reader_ptr_->Open(prefix + ".bin", max_param_size << 20))
CHECK(bin_reader_ptr_->Open(prefix + ".model", max_param_size << 20))
<< "Cannot open the checkpoint bin file:" << prefix + ".bin (>=1.0.1) "
@@ -72,6 +76,7 @@ Snapshot::Snapshot(const std::string& prefix, Mode mode, int max_param_size /*in
CHECK(tp.ParseFromString(val));
param_map_[key].FromProto(tp);
}
+ //need ro set version_ by getting data form param_map_["SINGA_VERSION"]?
} else {
LOG(FATAL)
<< "Mode for snapshot should be Snapshot::kWrite or Snapshot::kRead";
[incubator-singa] 02/03: SINGA-411 Local variable 'params'
referenced before assignment
Posted by wa...@apache.org.
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 <xu...@outlook.com>
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);
[incubator-singa] 01/03: SINGA-411 Local variable 'params'
referenced before assignment
Posted by wa...@apache.org.
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 7470b20301338f3e3aae88e0df4bf86bf9ce5ad3
Author: xuewanqi <xu...@outlook.com>
AuthorDate: Thu Nov 29 09:20:36 2018 +0000
SINGA-411 Local variable 'params' referenced before assignment
- fixed bug.
---
python/singa/net.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/python/singa/net.py b/python/singa/net.py
index e92d560..e30b075 100755
--- a/python/singa/net.py
+++ b/python/singa/net.py
@@ -471,8 +471,8 @@ class FeedForwardNet(object):
if f.endswith('.bin'):
f = f[0:-4]
sp = snapshot.Snapshot(f, True, buffer_size)
- v = tensor.from_numpy(np.array([__version__]))
- sp.write('SINGA_VERSION', v)
+ #v = tensor.from_numpy(np.array([__version__]))
+ #sp.write(b'SINGA_VERSION', v)
for (name, val) in zip(self.param_names(), self.param_values()):
val.to_host()
sp.write(name, val)