diff --git a/onnxruntime/test/perftest/TFModelInfo.cc b/onnxruntime/test/perftest/TFModelInfo.cc index faf7bccccb..8b161faf90 100644 --- a/onnxruntime/test/perftest/TFModelInfo.cc +++ b/onnxruntime/test/perftest/TFModelInfo.cc @@ -8,8 +8,10 @@ #include std::unique_ptr TFModelInfo::Create(_In_ const PATH_CHAR_TYPE* model_url) { - auto ret = std::unique_ptr(new TFModelInfo{}); - ret->model_url_ = model_url; + auto* model_info = new TFModelInfo{}; + std::unique_ptr ret(model_info); + + model_info->model_url_ = model_url; std::basic_string meta_file_path = model_url; meta_file_path.append(ORT_TSTR(".meta")); const onnxruntime::Env& env = onnxruntime::Env::Default(); @@ -40,15 +42,15 @@ std::unique_ptr TFModelInfo::Create(_In_ const PATH_CHAR_TYPE* mo } if (line.empty()) continue; if (line.compare(0, 6, "input=") == 0) { - ret->input_names_.push_back(line.substr(6)); + model_info->input_names_.push_back(line.substr(6)); } else if (line.compare(0, 7, "output=") == 0) { - ret->output_names_.push_back(line.substr(7)); + model_info->output_names_.push_back(line.substr(7)); } else { ORT_THROW("unknown line:", line.size()); } } - return std::move(ret); + return ret; } int TFModelInfo::GetInputCount() const { return static_cast(input_names_.size()); }