From 877ce27ea77d58103a35d6f2bc6a8bb2df4460c9 Mon Sep 17 00:00:00 2001 From: huzhiqiang <912790387@qq.com> Date: Wed, 26 Feb 2020 08:52:49 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90opt=20fix=E3=80=91change=20the=20optim?= =?UTF-8?q?ized=5Fmodel=20name=20of=20opt=20=20(#2892)=20(#3013)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lite/api/cxx_api.cc | 1 + lite/core/mir/subgraph/subgraph_pass_test.cc | 4 ++-- lite/model_parser/model_parser.cc | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lite/api/cxx_api.cc b/lite/api/cxx_api.cc index 9c0e8e1c34..f6f7ec75e6 100644 --- a/lite/api/cxx_api.cc +++ b/lite/api/cxx_api.cc @@ -43,6 +43,7 @@ void Predictor::SaveModel(const std::string &dir, LOG(FATAL) << "Unknown model type"; } if (record_info) { + MkDirRecur(dir); SaveOpKernelInfo(dir); } } diff --git a/lite/core/mir/subgraph/subgraph_pass_test.cc b/lite/core/mir/subgraph/subgraph_pass_test.cc index 2525179399..247795a86c 100644 --- a/lite/core/mir/subgraph/subgraph_pass_test.cc +++ b/lite/core/mir/subgraph/subgraph_pass_test.cc @@ -203,7 +203,7 @@ TEST(Subgraph, generate_model_and_check_precision) { valid_places, input_tensor_shape, input_tensor_type, - FLAGS_optimized_model_dir + "/ref_opt_model"); + FLAGS_optimized_model_dir + "_ref_opt_model"); // Generate and run optimized model on NPU/XPU as the target predictor #ifdef LITE_WITH_NPU valid_places.push_back(lite_api::Place{TARGET(kNPU), PRECISION(kFloat)}); @@ -217,7 +217,7 @@ TEST(Subgraph, generate_model_and_check_precision) { valid_places, input_tensor_shape, input_tensor_type, - FLAGS_optimized_model_dir + "/tar_opt_model"); + FLAGS_optimized_model_dir + "_tar_opt_model"); // Check the difference of the output tensors between reference predictor and // target predictor CheckOutputTensors(tar_predictor, ref_predictor, output_tensor_type); diff --git a/lite/model_parser/model_parser.cc b/lite/model_parser/model_parser.cc index 6eaf030928..08e6a30309 100644 --- a/lite/model_parser/model_parser.cc +++ b/lite/model_parser/model_parser.cc @@ -544,7 +544,6 @@ void SaveModelNaive(const std::string &model_dir, const Scope &exec_scope, const cpp::ProgramDesc &cpp_prog, bool combined) { - MkDirRecur(model_dir); // Save program const std::string prog_path = model_dir + ".nb"; naive_buffer::BinaryTable table; @@ -586,7 +585,8 @@ void SaveModelNaive(const std::string &model_dir, // Save Params SaveCombinedParamsNaive(prog_path, exec_scope, cpp_prog); - LOG(INFO) << "Save naive buffer model in '" << model_dir << "' successfully"; + LOG(INFO) << "Save naive buffer model in '" << model_dir + << ".nb' successfully"; } #endif -- GitLab