From 5e6c55a5a1015cbc19560bf0163b2325f80f8c8f Mon Sep 17 00:00:00 2001 From: shahn14 Date: Wed, 10 Apr 2024 19:21:12 +0900 Subject: [PATCH] Fix a bug in mean calculation of 'ys_probs' --- sherpa-onnx/csrc/transducer-keyword-decoder.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sherpa-onnx/csrc/transducer-keyword-decoder.cc b/sherpa-onnx/csrc/transducer-keyword-decoder.cc index f31348ea9..af78cb9c2 100644 --- a/sherpa-onnx/csrc/transducer-keyword-decoder.cc +++ b/sherpa-onnx/csrc/transducer-keyword-decoder.cc @@ -152,7 +152,7 @@ void TransducerKeywordDecoder::Decode( if (matched) { float ys_prob = 0.0; int32_t length = best_hyp.ys_probs.size(); - for (int32_t i = 1; i <= matched_state->level; ++i) { + for (int32_t i = 0; i < matched_state->level; ++i) { ys_prob += best_hyp.ys_probs[i]; } ys_prob /= matched_state->level;