CalcBeam()

This commit is contained in:
Hieu Hoang 2017-02-08 14:41:48 +00:00
parent 154831d07a
commit 98917c2554
2 changed files with 22 additions and 3 deletions

View File

@ -84,9 +84,7 @@ void Search::Decode(
}
}
Beams beams(batchSize);
bool returnAlignment = god.Get<bool>("return-alignment");
bestHyps_->CalcBeam(god, prevHyps, scorers_, filterIndices_, returnAlignment, beams, beamSizes);
CalcBeam(god, prevHyps, beams, beamSizes);
for (size_t i = 0; i < batchSize; ++i) {
if (!beams[i].empty()) {
@ -117,6 +115,19 @@ void Search::Decode(
}
}
void Search::CalcBeam(
const God &god,
Beam &prevHyps,
Beams &beams,
std::vector<size_t> &beamSizes
)
{
bool returnAlignment = god.Get<bool>("return-alignment");
bestHyps_->CalcBeam(god, prevHyps, scorers_, filterIndices_, returnAlignment, beams, beamSizes);
}
std::shared_ptr<Histories> Search::Process(const God &god, const Sentences& sentences) {
boost::timer::cpu_timer timer;

View File

@ -49,6 +49,14 @@ class Search {
BestHypsBasePtr bestHyps_;
DeviceInfo deviceInfo_;
void CalcBeam(
const God &god,
Beam &prevHyps,
Beams &beams,
std::vector<size_t> &beamSizes
);
};
}