未验证 提交 0961a938 编写于 作者: H huzhiqiang 提交者: GitHub

【opt fix】change the optimized_model name of opt (#2892)

上级 a387c6ce
...@@ -43,6 +43,7 @@ void Predictor::SaveModel(const std::string &dir, ...@@ -43,6 +43,7 @@ void Predictor::SaveModel(const std::string &dir,
LOG(FATAL) << "Unknown model type"; LOG(FATAL) << "Unknown model type";
} }
if (record_info) { if (record_info) {
MkDirRecur(dir);
SaveOpKernelInfo(dir); SaveOpKernelInfo(dir);
} }
} }
......
...@@ -203,7 +203,7 @@ TEST(Subgraph, generate_model_and_check_precision) { ...@@ -203,7 +203,7 @@ TEST(Subgraph, generate_model_and_check_precision) {
valid_places, valid_places,
input_tensor_shape, input_tensor_shape,
input_tensor_type, 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 // Generate and run optimized model on NPU/XPU as the target predictor
#ifdef LITE_WITH_NPU #ifdef LITE_WITH_NPU
valid_places.push_back(lite_api::Place{TARGET(kNPU), PRECISION(kFloat)}); valid_places.push_back(lite_api::Place{TARGET(kNPU), PRECISION(kFloat)});
...@@ -217,7 +217,7 @@ TEST(Subgraph, generate_model_and_check_precision) { ...@@ -217,7 +217,7 @@ TEST(Subgraph, generate_model_and_check_precision) {
valid_places, valid_places,
input_tensor_shape, input_tensor_shape,
input_tensor_type, 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 // Check the difference of the output tensors between reference predictor and
// target predictor // target predictor
CheckOutputTensors(tar_predictor, ref_predictor, output_tensor_type); CheckOutputTensors(tar_predictor, ref_predictor, output_tensor_type);
......
...@@ -544,7 +544,6 @@ void SaveModelNaive(const std::string &model_dir, ...@@ -544,7 +544,6 @@ void SaveModelNaive(const std::string &model_dir,
const Scope &exec_scope, const Scope &exec_scope,
const cpp::ProgramDesc &cpp_prog, const cpp::ProgramDesc &cpp_prog,
bool combined) { bool combined) {
MkDirRecur(model_dir);
// Save program // Save program
const std::string prog_path = model_dir + ".nb"; const std::string prog_path = model_dir + ".nb";
naive_buffer::BinaryTable table; naive_buffer::BinaryTable table;
...@@ -586,7 +585,8 @@ void SaveModelNaive(const std::string &model_dir, ...@@ -586,7 +585,8 @@ void SaveModelNaive(const std::string &model_dir,
// Save Params // Save Params
SaveCombinedParamsNaive(prog_path, exec_scope, cpp_prog); 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 #endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册