@@ -107,7 +107,7 @@ void OrtModel::reset(std::unordered_map<std::string, std::string> optionsMap)
107107 (pImplOrt->sessionOptions ).SetLogSeverityLevel (OrtLoggingLevel (loggingLevel));
108108
109109 pImplOrt->env = std::make_shared<Ort::Env>(OrtLoggingLevel (loggingLevel), (optionsMap[" onnx-environment-name" ].empty () ? " onnx_model_inference" : optionsMap[" onnx-environment-name" ].c_str ()));
110- ( pImplOrt->session ). reset ( new Ort::Session{ *(pImplOrt->env ), modelPath.c_str (), pImplOrt->sessionOptions } );
110+ pImplOrt->session = std::make_shared< Ort::Session>( *(pImplOrt->env ), modelPath.c_str (), pImplOrt->sessionOptions );
111111
112112 for (size_t i = 0 ; i < (pImplOrt->session )->GetInputCount (); ++i) {
113113 mInputNames .push_back ((pImplOrt->session )->GetInputNameAllocated (i, pImplOrt->allocator ).get ());
@@ -145,7 +145,7 @@ void OrtModel::reset(std::unordered_map<std::string, std::string> optionsMap)
145145
146146void OrtModel::resetSession ()
147147{
148- (pImplOrt->session ).reset (new Ort::Session{*(pImplOrt->env ), modelPath.c_str (), pImplOrt->sessionOptions });
148+ (pImplOrt->session ).reset (std::make_shared< Ort::Session> {*(pImplOrt->env ), modelPath.c_str (), pImplOrt->sessionOptions });
149149}
150150
151151template <class I , class O >
@@ -156,8 +156,9 @@ std::vector<O> OrtModel::v2v(std::vector<I>& input, bool clearInput)
156156 } else {
157157 std::vector<O> output (input.size ());
158158 std::transform (std::begin (input), std::end (input), std::begin (output), [](I f) { return O (f); });
159- if (clearInput)
159+ if (clearInput) {
160160 input.clear ();
161+ }
161162 return output;
162163 }
163164}
@@ -195,8 +196,9 @@ std::vector<O> OrtModel::inference(std::vector<std::vector<I>>& input)
195196std::string OrtModel::printShape (const std::vector<int64_t >& v)
196197{
197198 std::stringstream ss (" " );
198- for (size_t i = 0 ; i < v.size () - 1 ; i++)
199+ for (size_t i = 0 ; i < v.size () - 1 ; i++) {
199200 ss << v[i] << " x" ;
201+ }
200202 ss << v[v.size () - 1 ];
201203 return ss.str ();
202204}
0 commit comments