Add online transducer decoder (#27)

This commit is contained in:
Fangjun Kuang
2023-02-19 10:39:07 +08:00
committed by GitHub
parent 710edaa6f9
commit 0f6f58d1d3
13 changed files with 229 additions and 124 deletions

View File

@@ -46,4 +46,16 @@ void PrintModelMetadata(std::ostream &os, const Ort::ModelMetadata &meta_data) {
}
}
Ort::Value Clone(Ort::Value *v) {
auto type_and_shape = v->GetTensorTypeAndShapeInfo();
std::vector<int64_t> shape = type_and_shape.GetShape();
auto memory_info =
Ort::MemoryInfo::CreateCpu(OrtDeviceAllocator, OrtMemTypeDefault);
return Ort::Value::CreateTensor(memory_info, v->GetTensorMutableData<float>(),
type_and_shape.GetElementCount(),
shape.data(), shape.size());
}
} // namespace sherpa_onnx