diff --git a/ge/ir_build/atc_ir_common.cc b/ge/ir_build/atc_ir_common.cc index 2a77e386..77d749de 100755 --- a/ge/ir_build/atc_ir_common.cc +++ b/ge/ir_build/atc_ir_common.cc @@ -63,6 +63,19 @@ vector SplitInputShape(const std::string &input_shape) { } } // namespace +Status CheckInputFormat(const string &input_format) { + if (input_format.empty()) { + return ge::SUCCESS; + } + if (!ge::TypeUtils::IsFormatValid(input_format.c_str())) { + ErrorManager::GetInstance().ATCReportErrMessage( + "E10001", {"parameter", "value", "reason"}, {"--input_format", input_format, "input format is invalid!"}); + GELOGE(ge::PARAM_INVALID, "input format [%s] is invalid!", input_format.c_str()); + return ge::PARAM_INVALID; + } + return ge::SUCCESS; +} + bool CheckDynamicBatchSizeInputShapeValid(unordered_map> shape_map, std::string &dynamic_batch_size) { int32_t size = 0; diff --git a/ge/ir_build/atc_ir_common.h b/ge/ir_build/atc_ir_common.h index 47361167..b26c2f2b 100644 --- a/ge/ir_build/atc_ir_common.h +++ b/ge/ir_build/atc_ir_common.h @@ -75,6 +75,7 @@ Status CheckInsertOpConfParamValid(const std::string insert_op_conf); Status CheckDisableReuseMemoryParamValid(const std::string disable_reuse_memory); Status CheckEnableSingleStreamParamValid(const std::string enable_single_stream); Status CheckImplmodeParamValid(const std::string &optypelist_for_implmode, std::string &op_select_implmode); +Status CheckInputFormat(const string &input_format); void PrintOptionMap(std::map &options, std::string tips); void EraseEndSemicolon(std::string ¶m); } diff --git a/ge/ir_build/ge_ir_build.cc b/ge/ir_build/ge_ir_build.cc index 0e1d9452..c7ef6c1a 100644 --- a/ge/ir_build/ge_ir_build.cc +++ b/ge/ir_build/ge_ir_build.cc @@ -317,6 +317,10 @@ graphStatus Impl::CheckOptions(const std::map &options if (it != options_.end() && (CheckDisableReuseMemoryParamValid(it->second) != GRAPH_SUCCESS)) { return GRAPH_PARAM_INVALID; } + // Check Input Format + if (options_.find(kInputFormat) != options_.end()) { + return CheckInputFormat(options_[kInputFormat]); + } return GRAPH_SUCCESS; }