diff options
author | Hieu Hoang <hieuhoang@gmail.com> | 2018-01-22 02:54:38 +0300 |
---|---|---|
committer | Hieu Hoang <hieuhoang@gmail.com> | 2018-01-22 02:54:38 +0300 |
commit | c566b7c98831b40997a0256a20bfea78c4695f0c (patch) | |
tree | 40ea954bc65c771a36d52dc5a023e065e32a1522 | |
parent | 58446d80ac9e9d822c4a853211ff7ee8526bfeab (diff) |
trying to figure out number of sentences left in the batch
-rw-r--r-- | src/amun/common/histories.cpp | 11 | ||||
-rw-r--r-- | src/amun/common/histories.h | 2 | ||||
-rw-r--r-- | src/amun/common/search.cpp | 4 |
3 files changed, 15 insertions, 2 deletions
diff --git a/src/amun/common/histories.cpp b/src/amun/common/histories.cpp index f9e0ec48..a5f6ff5e 100644 --- a/src/amun/common/histories.cpp +++ b/src/amun/common/histories.cpp @@ -40,5 +40,16 @@ void Histories::Append(const Histories &other) } } +unsigned Histories::NumActive() const +{ + unsigned ret = 0; + for (size_t i = 0; i < coll_.size(); ++i) { + if (coll_[i]->front().size()) { + ++ret; + } + } + return ret; +} + } diff --git a/src/amun/common/histories.h b/src/amun/common/histories.h index c31579b9..6ab74f7a 100644 --- a/src/amun/common/histories.h +++ b/src/amun/common/histories.h @@ -35,6 +35,8 @@ class Histories { return beam; } + unsigned NumActive() const; + protected: std::vector<std::shared_ptr<History>> coll_; Histories(const Histories &) = delete; diff --git a/src/amun/common/search.cpp b/src/amun/common/search.cpp index a2f64588..5ab18f79 100644 --- a/src/amun/common/search.cpp +++ b/src/amun/common/search.cpp @@ -75,8 +75,8 @@ std::shared_ptr<Histories> Search::Translate(const Sentences& sentences) { break; } - //cerr << "beamSizes=" << beamSizes.size() << " " << prevHyps.size() << endl; - //++activeCount_[prevHyps.size()]; + cerr << "beamSizes=" << beamSizes.size() << " " << histories->NumActive() << endl; + ++activeCount_[histories->NumActive()]; } CleanAfterTranslation(); |