Support CoreML for macOS (#151)
This commit is contained in:
@@ -9,7 +9,6 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
#include <utility>
|
||||
@@ -140,8 +139,8 @@ class OnlineRecognizer::Impl {
|
||||
decoder_ =
|
||||
std::make_unique<OnlineTransducerGreedySearchDecoder>(model_.get());
|
||||
} else {
|
||||
fprintf(stderr, "Unsupported decoding method: %s\n",
|
||||
config.decoding_method.c_str());
|
||||
SHERPA_ONNX_LOGE("Unsupported decoding method: %s",
|
||||
config.decoding_method.c_str());
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
@@ -160,8 +159,8 @@ class OnlineRecognizer::Impl {
|
||||
decoder_ =
|
||||
std::make_unique<OnlineTransducerGreedySearchDecoder>(model_.get());
|
||||
} else {
|
||||
fprintf(stderr, "Unsupported decoding method: %s\n",
|
||||
config.decoding_method.c_str());
|
||||
SHERPA_ONNX_LOGE("Unsupported decoding method: %s",
|
||||
config.decoding_method.c_str());
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
@@ -216,19 +215,16 @@ class OnlineRecognizer::Impl {
|
||||
x_shape.size());
|
||||
|
||||
std::array<int64_t, 1> processed_frames_shape{
|
||||
static_cast<int64_t>(all_processed_frames.size())};
|
||||
static_cast<int64_t>(all_processed_frames.size())};
|
||||
|
||||
Ort::Value processed_frames = Ort::Value::CreateTensor(
|
||||
memory_info,
|
||||
all_processed_frames.data(),
|
||||
all_processed_frames.size(),
|
||||
processed_frames_shape.data(),
|
||||
processed_frames_shape.size());
|
||||
memory_info, all_processed_frames.data(), all_processed_frames.size(),
|
||||
processed_frames_shape.data(), processed_frames_shape.size());
|
||||
|
||||
auto states = model_->StackStates(states_vec);
|
||||
|
||||
auto pair = model_->RunEncoder(
|
||||
std::move(x), std::move(states), std::move(processed_frames));
|
||||
auto pair = model_->RunEncoder(std::move(x), std::move(states),
|
||||
std::move(processed_frames));
|
||||
|
||||
decoder_->Decode(std::move(pair.first), &results);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user