diff --git a/mindspore/lite/tools/common/flag_parser.cc b/mindspore/lite/tools/common/flag_parser.cc index 3ea4baac9b..7d35f49bd4 100755 --- a/mindspore/lite/tools/common/flag_parser.cc +++ b/mindspore/lite/tools/common/flag_parser.cc @@ -160,7 +160,7 @@ std::string FlagParser::Usage(const Option &usgMsg) const { std::string flagName = flag->second.flagName; std::string helpInfo = flag->second.helpInfo; // parameter line - std::string thisLine = flag->second.isBoolean ? " --[no-]" + flagName : " --" + flagName + "=VALUE"; + std::string thisLine = flagName == "help" ? " --" + flagName : " --" + flagName + "=VALUE"; if (++i <= flags.size()) { // add parameter help message of each line thisLine += " " + helpInfo; diff --git a/mindspore/lite/tools/common/flag_parser.h b/mindspore/lite/tools/common/flag_parser.h index e8e87ac699..b14824620e 100755 --- a/mindspore/lite/tools/common/flag_parser.h +++ b/mindspore/lite/tools/common/flag_parser.h @@ -33,7 +33,7 @@ struct Nothing {}; class FlagParser { public: - FlagParser() { AddFlag(&FlagParser::help, "help", "print usage message", false); } + FlagParser() { AddFlag(&FlagParser::help, "help", "print usage message", ""); } virtual ~FlagParser() {} @@ -298,4 +298,3 @@ void FlagParser::AddFlag(Option Flags::*t, const std::string &flagName, const } // namespace mindspore #endif // PREDICT_COMMON_FLAG_PARSER_H_ - diff --git a/mindspore/lite/tools/time_profile/time_profile.cc b/mindspore/lite/tools/time_profile/time_profile.cc index b872255230..09bec1f340 100644 --- a/mindspore/lite/tools/time_profile/time_profile.cc +++ b/mindspore/lite/tools/time_profile/time_profile.cc @@ -109,7 +109,7 @@ int TimeProfile::InitSession() { ctx->cpu_bind_mode_ = static_cast(_flags->cpu_bind_mode_); ctx->device_ctx_.type = lite::DT_CPU; ctx->thread_num_ = _flags->num_threads_; - + ctx->float16_priority = _flags->fp16_priority; session_ = session::LiteSession::CreateSession(ctx); if (session_ == nullptr) { MS_LOG(ERROR) << "New session failed while running."; @@ -175,6 +175,7 @@ int TimeProfile::Init() { MS_LOG(INFO) << "InDataPath = " << _flags->in_data_path_; MS_LOG(INFO) << "LoopCount = " << _flags->loop_count_; MS_LOG(INFO) << "NumThreads = " << _flags->num_threads_; + MS_LOG(INFO) << "Fp16Priority = " << _flags->fp16_priority; if (_flags->num_threads_ < 1) { MS_LOG(ERROR) << "NumThreads: " << _flags->num_threads_ << " must greater than or equal 1"; diff --git a/mindspore/lite/tools/time_profile/time_profile.h b/mindspore/lite/tools/time_profile/time_profile.h index 9dc6d57d4f..66bef7c3e8 100644 --- a/mindspore/lite/tools/time_profile/time_profile.h +++ b/mindspore/lite/tools/time_profile/time_profile.h @@ -40,6 +40,7 @@ class MS_API TimeProfileFlags : public virtual FlagParser { "Input -1 for MID_CPU, 1 for HIGHER_CPU, 0 for NO_BIND, defalut value: 1", 1); AddFlag(&TimeProfileFlags::loop_count_, "loopCount", "Run loop count", 10); AddFlag(&TimeProfileFlags::num_threads_, "numThreads", "Run threads number", 2); + AddFlag(&TimeProfileFlags::fp16_priority, "fp16Priority", "Run fp16 ops prior", false); } ~TimeProfileFlags() override = default; @@ -50,6 +51,7 @@ class MS_API TimeProfileFlags : public virtual FlagParser { int cpu_bind_mode_ = 1; int loop_count_; int num_threads_; + bool fp16_priority; }; class MS_API TimeProfile {