| | |
| | | session_options_.DisableCpuMemArena(); |
| | | |
| | | try { |
| | | m_session_ = std::make_unique<Ort::Session>(env_, am_model.c_str(), session_options_); |
| | | m_session_ = std::make_unique<Ort::Session>(env_, ORTSTRING(am_model).c_str(), session_options_); |
| | | LOG(INFO) << "Successfully load model from " << am_model; |
| | | } catch (std::exception const &e) { |
| | | LOG(ERROR) << "Error when load am onnx model: " << e.what(); |
| | |
| | | session_options_.DisableCpuMemArena(); |
| | | |
| | | try { |
| | | encoder_session_ = std::make_unique<Ort::Session>(env_, en_model.c_str(), session_options_); |
| | | encoder_session_ = std::make_unique<Ort::Session>(env_, ORTSTRING(en_model).c_str(), session_options_); |
| | | LOG(INFO) << "Successfully load model from " << en_model; |
| | | } catch (std::exception const &e) { |
| | | LOG(ERROR) << "Error when load am encoder model: " << e.what(); |
| | |
| | | } |
| | | |
| | | try { |
| | | decoder_session_ = std::make_unique<Ort::Session>(env_, de_model.c_str(), session_options_); |
| | | decoder_session_ = std::make_unique<Ort::Session>(env_, ORTSTRING(de_model).c_str(), session_options_); |
| | | LOG(INFO) << "Successfully load model from " << de_model; |
| | | } catch (std::exception const &e) { |
| | | LOG(ERROR) << "Error when load am decoder model: " << e.what(); |
| | |
| | | |
| | | // offline |
| | | try { |
| | | m_session_ = std::make_unique<Ort::Session>(env_, am_model.c_str(), session_options_); |
| | | m_session_ = std::make_unique<Ort::Session>(env_, ORTSTRING(am_model).c_str(), session_options_); |
| | | LOG(INFO) << "Successfully load model from " << am_model; |
| | | } catch (std::exception const &e) { |
| | | LOG(ERROR) << "Error when load am onnx model: " << e.what(); |
| | |
| | | hw_session_options.DisableCpuMemArena(); |
| | | |
| | | try { |
| | | hw_m_session = std::make_unique<Ort::Session>(hw_env_, hw_model.c_str(), hw_session_options); |
| | | hw_m_session = std::make_unique<Ort::Session>(hw_env_, ORTSTRING(hw_model).c_str(), hw_session_options); |
| | | LOG(INFO) << "Successfully load model from " << hw_model; |
| | | } catch (std::exception const &e) { |
| | | LOG(ERROR) << "Error when load hw compiler onnx model: " << e.what(); |
| | |
| | | return ""; |
| | | } |
| | | //PrintMat(hw_emb, "input_clas_emb"); |
| | | const int64_t hotword_shape[3] = {1, hw_emb.size(), hw_emb[0].size()}; |
| | | const int64_t hotword_shape[3] = {1, static_cast<int64_t>(hw_emb.size()), static_cast<int64_t>(hw_emb[0].size())}; |
| | | embedding.reserve(hw_emb.size() * hw_emb[0].size()); |
| | | for (auto item : hw_emb) { |
| | | embedding.insert(embedding.end(), item.begin(), item.end()); |