diff --git a/lite/load_and_run/src/strategys/strategy_fitting.cpp b/lite/load_and_run/src/strategys/strategy_fitting.cpp index 20960a010e95941deb07d9d498fcf3f91a10b49c..794d376024c1d5e9d64bc0e84680b4f97fcf8713 100644 --- a/lite/load_and_run/src/strategys/strategy_fitting.cpp +++ b/lite/load_and_run/src/strategys/strategy_fitting.cpp @@ -29,7 +29,8 @@ void OptionsFastManager::init(std::shared_ptr& options) { m_internal_options_name = { {"enable_fuse_conv_bias_with_z"}, {"enable_fuse_preprocess"}, - {"record_comp_seq"}}; + {"record_comp_seq"}, + {"const_shape"}}; //! record the independent option value for (auto& option : *options) { auto option_vals = option.second->get_option(); @@ -226,17 +227,21 @@ void OptionsTimeProfiler::profile_with_given_options( auto average = inference_time / runtime_param.run_iter; if (exception_state) { average = TIME_OUT; - } - - //! record profile result - printf("profile option:\n%s\naverage time = %.2f\n", option_code.c_str(), average); - m_options_profile_result.insert({option_code, average}); - - //! record the best result - - if (average < m_best_setting.second) { - m_best_setting.first = option_code; - m_best_setting.second = average; + printf("out of time (this may be caused by some exception, please checkout the " + "log) when profile option:\n%s\n", + option_code.c_str()); + } else { + printf("profile option:\n%s\naverage time = %.2f\n", option_code.c_str(), + average); + //! record profile result + m_options_profile_result.insert({option_code, average}); + + //! record the best result + + if (average < m_best_setting.second) { + m_best_setting.first = option_code; + m_best_setting.second = average; + } } } /////////////////////////// UserInfoParser ///////////////////////////// @@ -244,23 +249,9 @@ void UserInfoParser::get_user_info() { //! register user information tips std::vector> info_tips; m_user_info["fitting_preference"] = "Inferspeed"; - info_tips.push_back( - {"use_const_shape", "whether the input shape is constant?(yes/no)?"}); - - for (auto& tip : info_tips) { - std::cout << tip.second; - std::string answer = ""; - std::cin >> answer; - m_user_info[tip.first] = answer; - } } void UserInfoParser::parse_info(std::shared_ptr& manager) { std::vector fixed_options; - if (m_user_info["use_const_shape"] == "yes") { - fixed_options.push_back("const_shape"); - } else if (m_user_info["use_const_shape"] != "no") { - mgb_log_error("invalid user information for \"use_const_shape\""); - } fixed_options.push_back("enable_fuse_conv_bias_nonlinearity"); std::vector tmp_options;