Skip to content

Open-source speech recognition toolkit for training, inference, streaming ASR, VAD, punctuation, speaker diarization pipelines, and OpenAI-compatible/MCP serving.

fix func Forward

雾聪9ba0dbd98bf6
diff --git a/runtime/onnxruntime/src/paraformer-torch.cpp b/runtime/onnxruntime/src/paraformer-torch.cpp
index e7fbadf0a..e603e89a4 100644
--- a/runtime/onnxruntime/src/paraformer-torch.cpp
+++ b/runtime/onnxruntime/src/paraformer-torch.cpp
@@ -281,13 +281,18 @@ std::vector<std::string> ParaformerTorch::Forward(float** din, int* len, bool in
if(asr_feats.size() != 0){
LfrCmvn(asr_feats);
}
- feats_batch.emplace_back(asr_feats);
int32_t num_frames = asr_feats.size() / feature_dim;
paraformer_length.emplace_back(num_frames);
if(max_size < asr_feats.size()){
max_size = asr_feats.size();
max_frames = num_frames;
}
+
+ std::vector<float> flattened;
+ for (const auto& sub_vector : asr_feats) {
+ flattened.insert(flattened.end(), sub_vector.begin(), sub_vector.end());
+ }
+ feats_batch.emplace_back(flattened);
}
torch::NoGradGuard no_grad;