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 2016/01/05 19:10:35 UTC
[06/10] incubator-singa git commit: SINGA-120 - Implemented GRU and
BPTT: Made changes for debug tokenizer
SINGA-120 - Implemented GRU and BPTT: Made changes for debug tokenizer
Project: http://git-wip-us.apache.org/repos/asf/incubator-singa/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-singa/commit/b4b6a385
Tree: http://git-wip-us.apache.org/repos/asf/incubator-singa/tree/b4b6a385
Diff: http://git-wip-us.apache.org/repos/asf/incubator-singa/diff/b4b6a385
Branch: refs/heads/master
Commit: b4b6a38568a5b22829fa3500dc7621e2719bb62b
Parents: d43af9f
Author: Ju Fan <fa...@gmail.com>
Authored: Fri Jan 1 10:53:11 2016 +0800
Committer: Wei Wang <wa...@comp.nus.edu.sg>
Committed: Wed Jan 6 01:53:05 2016 +0800
----------------------------------------------------------------------
include/singa/utils/context.h | 4 ++--
include/singa/utils/tokenizer.h | 1 +
2 files changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/b4b6a385/include/singa/utils/context.h
----------------------------------------------------------------------
diff --git a/include/singa/utils/context.h b/include/singa/utils/context.h
index a2bc64f..8e7bbb8 100644
--- a/include/singa/utils/context.h
+++ b/include/singa/utils/context.h
@@ -154,9 +154,9 @@ class Context {
*/
std::mt19937* rand_generator(const std::thread::id& tid) {
if (rand_generator_.find(tid) == rand_generator_.end()) {
- CHECK(seed_.find(tid) != seed_.end());
+ // CHECK(seed_.find(tid) != seed_.end());
auto seed = static_cast<unsigned>(seed_[tid]);
- if (seed_[tid] == -1)
+ if (seed_.find(tid) == seed_.end() || seed_.at(tid) == -1)
seed = std::chrono::system_clock::now().time_since_epoch().count();
rand_generator_[tid] = new std::mt19937(seed);
}
http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/b4b6a385/include/singa/utils/tokenizer.h
----------------------------------------------------------------------
diff --git a/include/singa/utils/tokenizer.h b/include/singa/utils/tokenizer.h
index c66e0af..9637c75 100644
--- a/include/singa/utils/tokenizer.h
+++ b/include/singa/utils/tokenizer.h
@@ -37,6 +37,7 @@ namespace singa {
* t >> x; // x is wes
* cout << (t >> x); // print 0.
*/
+
class Tokenizer {
public:
Tokenizer(const std::string& str, const std::string& sep): start_(0),