Committed by
GitHub
Fix LogAdd (#316)
Using 0 as the initial value, should not perform addition when both values are 0
正在显示
1 个修改的文件
包含
2 行增加
和
0 行删除
| @@ -18,9 +18,11 @@ void Hypotheses::Add(Hypothesis hyp) { | @@ -18,9 +18,11 @@ void Hypotheses::Add(Hypothesis hyp) { | ||
| 18 | } else { | 18 | } else { |
| 19 | it->second.log_prob = LogAdd<double>()(it->second.log_prob, hyp.log_prob); | 19 | it->second.log_prob = LogAdd<double>()(it->second.log_prob, hyp.log_prob); |
| 20 | 20 | ||
| 21 | + if (it->second.lm_log_prob != 0 && hyp.lm_log_prob != 0){ | ||
| 21 | it->second.lm_log_prob = | 22 | it->second.lm_log_prob = |
| 22 | LogAdd<double>()(it->second.lm_log_prob, hyp.lm_log_prob); | 23 | LogAdd<double>()(it->second.lm_log_prob, hyp.lm_log_prob); |
| 23 | } | 24 | } |
| 25 | + } | ||
| 24 | } | 26 | } |
| 25 | 27 | ||
| 26 | Hypothesis Hypotheses::GetMostProbable(bool length_norm) const { | 28 | Hypothesis Hypotheses::GetMostProbable(bool length_norm) const { |
-
请 注册 或 登录 后发表评论