File tree Expand file tree Collapse file tree
fastdeploy/runtime/backends/ort Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -31,6 +31,16 @@ namespace fastdeploy {
3131std::vector<OrtCustomOp*> OrtBackend::custom_operators_ =
3232 std::vector<OrtCustomOp*>();
3333
34+ std::wstring ToWstring (const std::string &str) {
35+ unsigned len = str.size () * 2 ;
36+ setlocale (LC_CTYPE, " " );
37+ wchar_t *p = new wchar_t [len];
38+ mbstowcs (p, str.c_str (), len);
39+ std::wstring wstr (p);
40+ delete[] p;
41+ return wstr;
42+ }
43+
3444bool OrtBackend::BuildOption (const OrtBackendOption& option) {
3545 option_ = option;
3646 if (option.graph_optimization_level >= 0 ) {
@@ -47,7 +57,12 @@ bool OrtBackend::BuildOption(const OrtBackendOption& option) {
4757 session_options_.SetExecutionMode (ExecutionMode (option.execution_mode ));
4858 }
4959 if (!option.optimized_model_filepath .empty ()) {
60+ #if (defined(_WIN32) || defined(_WIN64))
61+ session_options_.SetOptimizedModelFilePath (
62+ ToWstring (option.optimized_model_filepath ).c_str ());
63+ #else
5064 session_options_.SetOptimizedModelFilePath (option.optimized_model_filepath .c_str ());
65+ #endif
5166 }
5267
5368#ifdef WITH_DIRECTML
You can’t perform that action at this time.
0 commit comments