Fix LogAdd (#316)

Using 0 as the initial value,  should not perform addition when both values are 0
This commit is contained in:
Peng He
2023-09-18 10:43:04 +08:00
committed by GitHub
parent c471423125
commit 5ca0ff8811

View File

@@ -18,8 +18,10 @@ void Hypotheses::Add(Hypothesis hyp) {
} else {
it->second.log_prob = LogAdd<double>()(it->second.log_prob, hyp.log_prob);
it->second.lm_log_prob =
if (it->second.lm_log_prob != 0 && hyp.lm_log_prob != 0){
it->second.lm_log_prob =
LogAdd<double>()(it->second.lm_log_prob, hyp.lm_log_prob);
}
}
}