diff --git a/parser/caffe/caffe_data_parser.cc b/parser/caffe/caffe_data_parser.cc index ecdb1c0..c7e46fd 100644 --- a/parser/caffe/caffe_data_parser.cc +++ b/parser/caffe/caffe_data_parser.cc @@ -56,7 +56,9 @@ Status CaffeDataParser::ParseParams(const Message *op_src, ge::OpDescPtr &op) { GE_CHK_STATUS_RET(ParseParamsForDummyData(layer, op), "[Parse][Params] failed, Caffe layer name = %s, " "layer type= %s", layer->name().c_str(), layer->type().c_str()); } else { - ErrorManager::GetInstance().ATCReportErrMessage("E11030"); + REPORT_INNER_ERROR("E19999", "layer:%s(%s) type is not %s or %s, check invalid", + layer->name().c_str(), layer->type().c_str(), + ge::parser::INPUT_TYPE.c_str(), ge::parser::DUMMY_DATA.c_str()); GELOGE(PARAM_INVALID, "[Check][Param] Caffe prototxt has no optype [Input]"); return FAILED; } @@ -93,8 +95,7 @@ Status CaffeDataParser::ParseParamsForInput(const domi::caffe::LayerParameter *l string name = layer->name(); auto search = input_dims.find(name); if (search == input_dims.end()) { - ErrorManager::GetInstance().ATCReportErrMessage( - "E11028", {"layername", "layertype"}, {layer->name(), layer->type()}); + REPORT_INPUT_ERROR("E11005", std::vector({"input"}), std::vector({layer->name()})); GELOGE(PARAM_INVALID, "[Check][Param] Caffe prototxt has no input_param or user " "should set --input_shape in atc parameter, caffe layer name [%s], layer type [%s].", layer->name().c_str(), layer->type().c_str()); @@ -139,8 +140,7 @@ Status CaffeDataParser::ParseParamsForDummyData(const domi::caffe::LayerParamete string name = layer->name(); auto search = input_dims.find(name); if (search == input_dims.end()) { - ErrorManager::GetInstance().ATCReportErrMessage( - "E11028", {"layername", "layertype"}, {layer->name(), layer->type()}); + REPORT_INPUT_ERROR("E11005", std::vector({"input"}), std::vector({layer->name()})); GELOGE(PARAM_INVALID, "[Check][Param] Caffe prototxt has no input_param or user " "should set --input_shape in atc parameter, caffe layer name [%s], layer type [%s].", layer->name().c_str(), layer->type().c_str()); diff --git a/parser/caffe/caffe_op_parser.cc b/parser/caffe/caffe_op_parser.cc index 77d2229..b16b9b9 100644 --- a/parser/caffe/caffe_op_parser.cc +++ b/parser/caffe/caffe_op_parser.cc @@ -64,9 +64,8 @@ Status CaffeOpParser::ConvertWeight(const BlobProto &proto, const string &lay_na } if (dim >= INT64_MAX / count) { - ErrorManager::GetInstance().ATCReportErrMessage("E11033", {"opname", "blobsize", "reason"}, - {lay_name, std::to_string(dim) + "*" + std::to_string(count), - "it exceeds INT64_MAX[" + std::to_string(INT64_MAX) + "]"}); + REPORT_INNER_ERROR("E19999", "Convert weight fail, shape:%s of layer:%s will overflow after multi", + shape.ToString().c_str(), lay_name.c_str()); GELOGE(FAILED, "[Check][Size]Convert weight fail, Blob size exceeds INT64_MAX, dim:%d, count:%d, layer name:%s", dim, count, lay_name.c_str()); return FAILED; diff --git a/parser/caffe/caffe_parser.cc b/parser/caffe/caffe_parser.cc index 7010fae..9ea40e5 100644 --- a/parser/caffe/caffe_parser.cc +++ b/parser/caffe/caffe_parser.cc @@ -68,7 +68,7 @@ using std::ifstream; do { \ if (val == nullptr) { \ GELOGE(ge::PARAM_INVALID, errormsg); \ - ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {errormsg}); \ + REPORT_INNER_ERROR("E19999", errormsg); \ return ge::PARAM_INVALID; \ } \ } while (0) @@ -282,9 +282,6 @@ Status CaffeModelParser::ParseInput(domi::caffe::NetParameter &proto_message, bo return FAILED; } int input_dim_size = proto_message.input_dim_size(); - GE_CHK_BOOL_TRUE_EXEC_WITH_LOG((proto_message.input_size() == 0), - ErrorManager::GetInstance().ATCReportErrMessage("E11002"); - return PARAM_INVALID, "[Check][Size]Model has no input."); GE_CHK_BOOL_TRUE_EXEC_WITH_LOG((input_dim_size / proto_message.input_size() != parser::DIM_DEFAULT_SIZE || input_dim_size % proto_message.input_size() != 0), @@ -347,7 +344,7 @@ Status CaffeModelParser::ParseInput(domi::caffe::NetParameter &proto_message, bo for (int i = 0; i < proto_message.input_size(); i++) { string name = proto_message.input(i); if (input_dims.count(name) == 0) { // Input defined by model does not exist in input of external input - ErrorManager::GetInstance().ATCReportErrMessage("E11005"); + REPORT_INPUT_ERROR("E11005", std::vector({"input"}), std::vector({name})); GELOGE(FAILED, "[Find][Dim]Model has no input shape."); return FAILED; } @@ -372,7 +369,6 @@ Status CaffeModelParser::ParseInput(domi::caffe::NetParameter &proto_message, bo } } } - return SUCCESS; } @@ -403,8 +399,9 @@ Status CaffeModelParser::ParseNetModelByCustomProto(const char *model_path, cons const google::protobuf::Descriptor *layer_descriptor = importer.pool()->FindMessageTypeByName(kLayerMessageType); if (layer_descriptor == nullptr) { delete message; - ErrorManager::GetInstance().ATCReportErrMessage( - "E19021", {"reason"}, {"Does not find domi.caffe.LayerParameter in google::protobuf::Descriptor"}); + REPORT_INPUT_ERROR("E11032", std::vector({"message_type", "name", "reason"}), + std::vector({"model", "LayerParameter", + "Does not find domi.caffe.LayerParameter in google::protobuf::Descriptor"})); GELOGE(FAILED, "[Invoke][FindMessageTypeByName]Does not find domi.caffe.LayerParameter" "in google::protobuf::Descriptor"); return FAILED; @@ -444,122 +441,10 @@ Status CaffeModelParser::CustomProtoParse(const char *model_path, const string & return ret; } -Status CaffeModelParser::GetIdentifier(const std::string &line, int32_t &identifier) { - size_t size = line.size(); - size_t pos = line.find("="); - if (pos == std::string::npos) { - ErrorManager::GetInstance().ATCReportErrMessage("E11032", {"name", "reason"}, - {line.c_str(), "it must contain '='"}); - GELOGE(FAILED, "[Check][Param]line: %s must contain char =.", line.c_str()); - return FAILED; - } - for (size_t i = pos + 1; i < size; i++) { - if (line[i] == ';') { - break; - } - if (identifier > kMaxIdentifier || identifier < 0) { - ErrorManager::GetInstance().ATCReportErrMessage( - "E11032", {"name", "reason"}, {to_string(identifier), "it can not exceed max value or less than 0"}); - GELOGE(FAILED, "[Check][Param]Param identifier exceeded max value:%d, identifier: %d.", - kMaxIdentifier, identifier); - return FAILED; - } - if (line[i] >= '0' && line[i] <= '9') { - identifier = identifier * kBase + line[i] - '0'; - } - } - - if (identifier == 0) { - ErrorManager::GetInstance().ATCReportErrMessage( - "E11032", {"name", "reason"}, {to_string(identifier), "it must larger than 0"}); - GELOGE(FAILED, "[Check][Param]Param identifier must larger than zero, identifier: %d.", identifier); - return FAILED; - } - return SUCCESS; -} - -Status CaffeModelParser::SaveIdentifierOpMapInfo(const string &line, std::map &identifier_op_map) { - std::vector op_param_info; - - // get op param info - std::istringstream string_stream(line); - std::string temp; - while (std::getline(string_stream, temp, ' ')) { - if (temp.empty()) { - continue; - } - op_param_info.emplace_back(std::move(temp)); - } - if (op_param_info.size() < kMinLineWorldSize) { - ErrorManager::GetInstance().ATCReportErrMessage( - "E12025", {"size", "compare", "name"}, {to_string(op_param_info.size()), "larger", "min size"}); - GELOGE(FAILED, "[Check][Size]Op param size(%zu) must larger than min size:%d.", - op_param_info.size(), kMinLineWorldSize); - return FAILED; - } - if (op_param_info[0] != kOptional && op_param_info[0] != kRepeated && op_param_info[0] != kRequired) { - ErrorManager::GetInstance().ATCReportErrMessage("E11032", {"name", "reason"}, - {op_param_info[0].c_str(), "First value of op param is not in [optional, repeated, required]"}); - GELOGE(FAILED, "[Check][Value]First value of op param is not in [optional:%s, repeated:%s, required:%s]," - "first value: %s", kOptional.c_str(), kRepeated.c_str(), kRequired.c_str(), op_param_info[0].c_str()); - return FAILED; - } - - // get identifier - int32_t identifier = 0; - if (GetIdentifier(line, identifier) != SUCCESS) { - ErrorManager::GetInstance().ATCReportErrMessage("E11032", {"name", "reason"}, - {to_string(identifier), "Get identifier failed"}); - GELOGE(FAILED, "[Get][Identifier] failed, identifier: %d", identifier); - return FAILED; - } - identifier_op_map[identifier] = op_param_info[1]; - return SUCCESS; -} - -Status CaffeModelParser::ParseProtoFile(const string &proto_file, std::map &identifier_op_map) { - ifstream read_file; - read_file.open(proto_file, std::ios::in); - if (read_file.fail()) { - ErrorManager::GetInstance().ATCReportErrMessage("E19001", {"file", "errmsg"}, - {proto_file.c_str(), "ifstream open failed"}); - GELOGE(FAILED, "[Open][File]Ifsream open caffe proto:%s failed.", proto_file.c_str()); - return FAILED; - } - - std::string line; - bool save_flag = false; - while (std::getline(read_file, line)) { - // set save flag when find message LayerParameter - if (line.find(kMessage) != std::string::npos && line.find(kLayerParameter) != std::string::npos) { - save_flag = true; - continue; - } - // stop to save when message end find (}) - if (save_flag && line.find(kCloseBrace) != std::string::npos) { - break; - } - // save identifier and op info - if (save_flag) { - if (line.find(kRepeated) == std::string::npos && line.find(kOptional) == std::string::npos && - line.find(kRequired) == std::string::npos) { - continue; - } - if (SaveIdentifierOpMapInfo(line, identifier_op_map) != SUCCESS) { - read_file.close(); - GELOGE(FAILED, "[Save][IdentifierOpMapInfo] failed, line:%s.", line.c_str()); - return FAILED; - } - } - } - read_file.close(); - return SUCCESS; -} - Status CaffeModelParser::ReadModelWithoutWarning(const char *model_path, google::protobuf::Message *message) { int32_t copy_fd = mmDup(STDERR_FILENO); if (copy_fd < 0) { - ErrorManager::GetInstance().ATCReportErrMessage("E19020", {"file", "errmsg"}, {"STDERR_FILENO", strerror(errno)}); + REPORT_CALL_ERROR("E19999", "Duplicate to file STDERR_FILENO failed, errmsg:%s", strerror(errno)); GELOGE(FAILED, "[Invoke][Dup] failed:%d, reason:%s", copy_fd, strerror(errno)); return FAILED; } @@ -575,7 +460,7 @@ Status CaffeModelParser::ReadModelWithoutWarning(const char *model_path, google: if (mmDup2(fd, STDERR_FILENO) < 0) { (void)mmClose(fd); (void)mmClose(copy_fd); - ErrorManager::GetInstance().ATCReportErrMessage("E19020", {"file", "errmsg"}, {"STDERR_FILENO", strerror(errno)}); + REPORT_CALL_ERROR("E19999", "Duplicate to file STDERR_FILENO failed, errmsg:%s", strerror(errno)); GELOGE(FAILED, "[Invoke][Dup2] Re-orient failed. reason:%s", strerror(errno)); return FAILED; } @@ -590,7 +475,7 @@ Status CaffeModelParser::ReadModelWithoutWarning(const char *model_path, google: if (mmDup2(copy_fd, STDERR_FILENO) < 0) { (void)mmClose(fd); (void)mmClose(copy_fd); - ErrorManager::GetInstance().ATCReportErrMessage("E19020", {"file", "errmsg"}, {"STDERR_FILENO", strerror(errno)}); + REPORT_CALL_ERROR("E19999", "Duplicate to file STDERR_FILENO failed, errmsg:%s", strerror(errno)); GELOGE(FAILED, "[Invoke][Dup2] Re-orient failed. reason:%s", strerror(errno)); return FAILED; } @@ -645,8 +530,8 @@ Status CaffeModelParser::ParseLayerParameter(const google::protobuf::Descriptor continue; } if (!field->is_repeated()) { - ErrorManager::GetInstance().ATCReportErrMessage("E11032", {"name", "reason"}, - {field->name().c_str(), "LayerParameter should be repeated"}); + REPORT_INPUT_ERROR("E11032", std::vector({"message_type", "name", "reason"}), + std::vector({"model", field->name(), "LayerParameter should be repeated"})); GELOGE(FAILED, "[Check][Param] LayerParameter should be repeated."); return FAILED; } @@ -676,7 +561,8 @@ Status CaffeModelParser::ParseLayerParameter(const google::protobuf::Descriptor Status CaffeModelParser::CreateCustomOperator(string op_name, string op_type, const google::protobuf::Message *message, int index, vector &operators) { if (op_name.empty() || op_type.empty()) { - ErrorManager::GetInstance().ATCReportErrMessage("E12026", {"name", "type"}, {op_name.c_str(), op_type.c_str()}); + REPORT_INNER_ERROR("E19999", "[Check][Param]Name or type of layer is empty, name: %s, type: %s.", + op_name.c_str(), op_type.c_str()); GELOGE(FAILED, "[Check][Param]Name or type of layer is empty, name: %s, type: %s.", op_name.c_str(), op_type.c_str()); return FAILED; @@ -685,7 +571,8 @@ Status CaffeModelParser::CreateCustomOperator(string op_name, string op_type, co GELOGI("Start to create new operator, name: %s, type: %s, index: %d.", op_name.c_str(), op_type.c_str(), index); ge::Operator ops(op_name, op_type); if (ops.GetName() != op_name) { - ErrorManager::GetInstance().ATCReportErrMessage("E12027", {"name", "type"}, {op_name.c_str(), op_type.c_str()}); + REPORT_INNER_ERROR("E19999", "Create Operator failed, name: %s, type: %s, index: %d.", + op_name.c_str(), op_type.c_str(), index); GELOGE(FAILED, "[Create][Operator] failed, name: %s, type: %s, index: %d.", op_name.c_str(), op_type.c_str(), index); return FAILED; @@ -772,8 +659,8 @@ Status CaffeModelParser::ParseField(const google::protobuf::Reflection *reflecti break; } default: { - ErrorManager::GetInstance().ATCReportErrMessage("E11032", {"name", "reason"}, - {field->name().c_str(), "Unsupported field type"}); + REPORT_INPUT_ERROR("E11032", std::vector({"message_type", "name", "reason"}), + std::vector({"model", field->name(), "Unsupported field type"})); GELOGE(FAILED, "[Check][FieldType]Unsupported field type, name: %s.", field->name().c_str()); return FAILED; } @@ -820,11 +707,11 @@ Status CaffeModelParser::ParseRepeatedField(const google::protobuf::Reflection * try { repeated_message_str = message_json.dump(kInteval, ' ', false, Json::error_handler_t::ignore); } catch (std::exception &e) { - ErrorManager::GetInstance().ATCReportErrMessage("E19007", {"exception"}, {e.what()}); + REPORT_INNER_ERROR("E19999", "Failed to convert JSON to string, reason: %s.", e.what()); GELOGE(FAILED, "[Parse][JSON]Failed to convert JSON to string, reason: %s.", e.what()); return FAILED; } catch (...) { - ErrorManager::GetInstance().ATCReportErrMessage("E19008"); + REPORT_INNER_ERROR("E19999", "Failed to convert JSON to string."); GELOGE(FAILED, "[Parse][JSON]Failed to convert JSON to string."); return FAILED; } @@ -832,8 +719,8 @@ Status CaffeModelParser::ParseRepeatedField(const google::protobuf::Reflection * break; } default: { - ErrorManager::GetInstance().ATCReportErrMessage("E11032", {"name", "reason"}, - {field->name().c_str(), "Unsupported field type"}); + REPORT_INPUT_ERROR("E11032", std::vector({"message_type", "name", "reason"}), + std::vector({"model", field->name(), "Unsupported field type"})); GELOGE(FAILED, "[Check][FieldType]Unsupported field type, name: %s.", field->name().c_str()); return FAILED; } @@ -889,8 +776,7 @@ Status CaffeModelParser::ParseOutputNodeTopInfo(const domi::caffe::NetParameter } } if (!find_node_falg || layer_name.empty()) { - ErrorManager::GetInstance().ATCReportErrMessage( - "E11032", {"name", "reason"}, {top_name.c_str(), "Cannot find the top_name, which is invalid"}); + REPORT_INPUT_ERROR("E11017", std::vector({"opname"}), std::vector({top_name})); GELOGE(PARAM_INVALID, "[Check][Param]Cannot find top_name[%s], which is invalid", top_name.c_str()); return PARAM_INVALID; } @@ -903,7 +789,7 @@ Status CaffeModelParser::ParseOutputNodeTopInfo(const domi::caffe::NetParameter Status CaffeModelParser::AddBlobsToMap(const domi::caffe::LayerParameter &layer, std::map &inplace_blob_name_remapping) { if (layer.top_size() <= 0) { - ErrorManager::GetInstance().ATCReportErrMessage("E19011", {"opname"}, {layer.name()}); + ErrorManager::GetInstance().ATCReportErrMessage("E11037", {"opname"}, {layer.name()}); GELOGE(FAILED, "[Check][Size]The output size of layer %s needs to be greater than zero.", layer.name().c_str()); return FAILED; } @@ -1011,7 +897,7 @@ Status CaffeModelParser::ParseOpParam(const domi::caffe::LayerParameter &layer, vector custom_operator; status = GetCustomOp(layer, custom_operator); if (status != SUCCESS || custom_operator.empty()) { - ErrorManager::GetInstance().ATCReportErrMessage("E11010", {"opname", "optype"}, {layer.name(), op_type}); + REPORT_CALL_ERROR("E19999", "Get CustomOp failed for op:%s(%s)", layer.name().c_str(), op_type.c_str()); GELOGE(status, "[Get][CustomOp]failed for op [%s], optype [%s]", layer.name().c_str(), op_type.c_str()); return status; @@ -1020,7 +906,7 @@ Status CaffeModelParser::ParseOpParam(const domi::caffe::LayerParameter &layer, } if (status != SUCCESS) { - ErrorManager::GetInstance().ATCReportErrMessage("E11010", {"opname", "optype"}, {layer.name(), op_type}); + REPORT_CALL_ERROR("E19999", "Parse param for op:%s(%s) failed", layer.name().c_str(), op_type.c_str()); GELOGE(status, "[Parse][Params] for op [%s] fail, optype [%s]", layer.name().c_str(), op_type.c_str()); return status; } @@ -1033,60 +919,39 @@ Status CaffeModelParser::AddNode(const domi::caffe::LayerParameter &layer, ge::C // Release in node destructor string op_type; - // Python type parsing is supported in the model file. Python layer is a user-defined layer, - // which can represent a variety of operator types. Currently, proposal operator is supported - if (layer.type() == kPython) { - // Judge whether there is Python_Param. If not, it is illegal - if (!layer.has_python_param()) { - ErrorManager::GetInstance().ATCReportErrMessage("E11006", {"opname"}, {layer.name()}); - GELOGE(FAILED, "[Check][Param]Op[%s] optype[Python] has no python_param.", layer.name().c_str()); - return FAILED; - } - - const domi::caffe::PythonParameter &python_param = layer.python_param(); - // Judge whether it is a Proposal operator - if (python_param.layer() == kProposalLayer) { - ErrorManager::GetInstance().ATCReportErrMessage("E11031", {"opname"}, {layer.name()}); - GELOGE(PARAM_INVALID, "[Check][Param]Python Layer %s need to be rewritten according to product directions", - layer.name().c_str()); - return FAILED; + op_type = layer.type(); + // User defined duplicate name operator processing + auto m_iter = ge::GetParserContext().op_conf_map.find(op_type); + // User specified configuration item found + if (m_iter != ge::GetParserContext().op_conf_map.end()) { + op_type = m_iter->second; + } + // General layer layer, search optype + auto iter = caffe_op_map.find(op_type); + if (iter == caffe_op_map.end()) { + if (op_type == kDetectionOutput) { + ErrorManager::GetInstance().ATCReportErrMessage("E11008"); + GELOGE(FAILED, "[Check][Type] Op type 'DetectionOutput' is confused. Suggest you modify the model file " + "and use a explicit type, such as 'FSRDetectionOutput' or 'SSDDetectionOutput'."); } else { - ErrorManager::GetInstance().ATCReportErrMessage("E11007", {"opname"}, {python_param.layer()}); - GELOGE(FAILED, "[Check][Param]If optype is [Python], opname must be [ProposalLayer], " - "but actual opname is [%s].", python_param.layer().c_str()); - return FAILED; + ErrorManager::GetInstance().ATCReportErrMessage("E11009", {"opname", "optype"}, {layer.name(), op_type}); + GELOGE(FAILED, "[Check][Type]Unsupport op[%s] optype[%s], you should customize the op at first.", + layer.name().c_str(), op_type.c_str()); } - } else { - op_type = layer.type(); - // User defined duplicate name operator processing - auto m_iter = ge::GetParserContext().op_conf_map.find(op_type); - // User specified configuration item found - if (m_iter != ge::GetParserContext().op_conf_map.end()) { - op_type = m_iter->second; - } - // General layer layer, search optype - auto iter = caffe_op_map.find(op_type); - if (iter == caffe_op_map.end()) { - if (op_type == kDetectionOutput) { - ErrorManager::GetInstance().ATCReportErrMessage("E11008"); - GELOGE(FAILED, "[Check][Type] Op type 'DetectionOutput' is confused. Suggest you modify the model file " - "and use a explicit type, such as 'FSRDetectionOutput' or 'SSDDetectionOutput'."); - } else { - ErrorManager::GetInstance().ATCReportErrMessage("E11009", {"opname", "optype"}, {layer.name(), op_type}); - GELOGE(FAILED, "[Check][Type]Unsupport op[%s] optype[%s], you should customize the op at first.", - layer.name().c_str(), op_type.c_str()); - } - return FAILED; - } - op_type = iter->second; + return FAILED; } + op_type = iter->second; + GELOGD("Caffe layer name:%s, layer type %s", layer.name().c_str(), op_type.c_str()); // create OpParser std::shared_ptr factory = OpParserFactory::Instance(domi::CAFFE); GE_CHECK_NOTNULL(factory); std::shared_ptr op_parser = factory->CreateOpParser(op_type); - GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(op_parser == nullptr, return FAILED, "op_parser is null, op_type: %s.", + GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(op_parser == nullptr, + ErrorManager::GetInstance().ATCReportErrMessage("E11009", {"opname", "optype"}, + {layer.name(), op_type}); + return FAILED, "op_parser is null, op_type: %s.", op_type.c_str()); ge::OpDescPtr op; @@ -1196,7 +1061,7 @@ Status CaffeModelParser::AddTensorDescToOpDescByIr(ge::OpDescPtr &op_desc, const string layer_name = layer.name(); ge::Operator op_factory = ge::OperatorFactory::CreateOperator(layer_name, op_type); if (op_factory.GetName() != layer.name()) { - ErrorManager::GetInstance().ATCReportErrMessage("E11011", {"opname", "optype"}, {layer_name, op_type}); + ErrorManager::GetInstance().ATCReportErrMessage("E10501", {"opname", "optype"}, {layer_name, op_type}); GELOGE(FAILED, "[Invoke][CreateOperator]IR for op[%s] optype[%s] is not registered.", layer_name.c_str(), op_type.c_str()); return FAILED; @@ -1285,9 +1150,9 @@ Status CaffeModelParser::AddEdges(ge::ComputeGraphPtr &graph) { ge::InDataAnchorPtr in_archor_ptr = bottom_node_iter->second->GetInDataAnchor(bottom_blob_layer_pair.second); GE_CHECK_NOTNULL(in_archor_ptr); GE_IF_BOOL_EXEC(ge::GraphUtils::AddEdge(out_archor_ptr, in_archor_ptr) != ge::GRAPH_SUCCESS, - ErrorManager::GetInstance().ATCReportErrMessage("E11013", {"opname1", "opname2"}, - {top_node_iter->second->GetName(), - bottom_node_iter->second->GetName()}); + REPORT_CALL_ERROR("E19999", "Add edge between %s and %s failed", + top_node_iter->second->GetName().c_str(), + bottom_node_iter->second->GetName().c_str()); GELOGE(INTERNAL_ERROR, "[Invoke][AddEdge]Add link failed from op[%s] to op[%s].", top_node_iter->second->GetName().c_str(), bottom_node_iter->second->GetName().c_str()); return INTERNAL_ERROR;); @@ -1648,7 +1513,7 @@ void CaffeModelParser::SaveOrigionLayerTops(domi::caffe::LayerParameter &layer) Status CaffeModelParser::SaveDataLayerTops(const domi::caffe::LayerParameter &layer) { string name = layer.name(); if (node_map.find(name) == node_map.end()) { - ErrorManager::GetInstance().ATCReportErrMessage("E11034", {"opname"}, {name}); + REPORT_INNER_ERROR("E19999", "layer:%s not find in node_map after AddNode, exist error before", name.c_str()); GELOGE(FAILED, "[Find][Node]Node can not be found by layer name: %s", name.c_str()); return FAILED; } @@ -2033,8 +1898,9 @@ Status CaffeWeightsParser::ParseWeightByFusionProto(const char *weight_path, con const google::protobuf::Descriptor *descriptor = importer.pool()->FindMessageTypeByName(kBeginningMessageType); if (descriptor == nullptr) { - ErrorManager::GetInstance().ATCReportErrMessage( - "E19021", {"reason"}, {"Does not find domi.caffe.NetParameter in google::protobuf::Descriptor."}); + REPORT_INPUT_ERROR("E11032", std::vector({"message_type", "name", "reason"}), + std::vector({"weight", "NetParameter", + "Does not find domi.caffe.NetParameter in google::protobuf::Descriptor."})); GELOGE(FAILED, "[Invoke][FindMessageTypeByName]Does not find domi.caffe.NetParameter in " "google::protobuf::Descriptor, which may be caused by problematic fusion proto."); return FAILED; @@ -2048,8 +1914,8 @@ Status CaffeWeightsParser::ParseWeightByFusionProto(const char *weight_path, con if (!ge::parser::ReadProtoFromBinaryFile(weight_path, message)) { delete message; message = nullptr; - ErrorManager::GetInstance().ATCReportErrMessage( - "E19021", {"reason"}, {"ReadProtoFromBinaryFile based on fusion proto failed."}); + REPORT_CALL_ERROR("E19999", "ReadProtoFromBinaryFile based on fusion proto failed from weight file:%s.", + weight_path); GELOGE(FAILED, "[Invoke][ReadProtoFromBinaryFile] %s failed.", weight_path); return FAILED; } @@ -2059,8 +1925,9 @@ Status CaffeWeightsParser::ParseWeightByFusionProto(const char *weight_path, con if (layer_descriptor == nullptr) { delete message; message = nullptr; - ErrorManager::GetInstance().ATCReportErrMessage( - "E19021", {"reason"}, {"Does not find domi.caffe.LayerParameter in google::protobuf::Descriptor"}); + REPORT_INPUT_ERROR("E11032", std::vector({"message_type", "name", "reason"}), + std::vector({"weight", "NetParameter", + "Does not find domi.caffe.LayerParameter in google::protobuf::Descriptor"})); GELOGE(FAILED, "[Invoke][FindMessageTypeByName]Does not find domi.caffe.LayerParameter in google::protobuf::Descriptor"); return FAILED; @@ -2075,8 +1942,7 @@ Status CaffeWeightsParser::ParseWeightByFusionProto(const char *weight_path, con if (ParseLayerParameter(layer_descriptor, message, graph) != SUCCESS) { delete message; message = nullptr; - ErrorManager::GetInstance().ATCReportErrMessage( - "E19021", {"reason"}, {"ParseLayerParameter failed."}); + REPORT_CALL_ERROR("E19999", "ParseLayerParameter failed failed from weight file:%s.", weight_path); GELOGE(FAILED, "[Parse][LayerParameter] failed."); return FAILED; } @@ -2109,8 +1975,8 @@ Status CaffeWeightsParser::ParseLayerParameter(const google::protobuf::Descripto continue; } if (!field->is_repeated()) { - ErrorManager::GetInstance().ATCReportErrMessage("E11032", {"name", "reason"}, - {field->name().c_str(), "LayerParameter should be repeated"}); + REPORT_INPUT_ERROR("E11032", std::vector({"message_type", "name", "reason"}), + std::vector({"weight", field->name(), "LayerParameter should be repeated"})); GELOGE(FAILED, "[Check][Param] LayerParameter should be repeated, field:%s.", field->name().c_str()); return FAILED; } @@ -2340,8 +2206,8 @@ Status CaffeWeightsParser::CheckLayersSize(const google::protobuf::Message *mess continue; } if (!field->is_repeated()) { - ErrorManager::GetInstance().ATCReportErrMessage("E11032", {"name", "reason"}, - {field->name().c_str(), "LayerParameter should be repeated"}); + REPORT_INPUT_ERROR("E11032", std::vector({"message_type", "name", "reason"}), + std::vector({"weight", field->name(), "LayerParameter should be repeated"})); GELOGE(FAILED, "[Check][Param] LayerParameter should be repeated. field:%s", field->name().c_str()); return FAILED; } @@ -2418,14 +2284,16 @@ Status CaffeWeightsParser::ConvertLayerParameter(const google::protobuf::Message GE_CHK_BOOL_TRUE_EXEC_WITH_LOG( (op_parser.get() == nullptr), - ErrorManager::GetInstance().ATCReportErrMessage("E11025", {"opname", "optype"}, {layer_name, op_type}); + REPORT_INPUT_ERROR("E11009", std::vector({"opname", "optype"}), + std::vector({layer_name, op_type})); return FAILED, "[Create][OpParser] failed for Op[%s], optype is %s", layer_name.c_str(), op_type.c_str()); // Parsing weight information through op parser Status status = op_parser->ParseWeights(layer_message, node); GE_CHK_BOOL_TRUE_EXEC_WITH_LOG( - (status != SUCCESS), ErrorManager::GetInstance().ATCReportErrMessage("E11026", {"opname"}, {layer_name}); + (status != SUCCESS), + REPORT_CALL_ERROR("E19999", "Parse weight for op:%s(%s) failed", layer_name.c_str(), op_type.c_str()); return status, "[Parse][Weights] for op[%s] failed", layer_name.c_str()); } @@ -2452,8 +2320,8 @@ Status CaffeWeightsParser::CheckNodes(ge::ComputeGraphPtr &graph) { PreChecker::Instance().RefreshErrorMessageByName(node->GetName(), PreChecker::PARAM_INVALID, "Node does not exist in weight file."); } else { - ErrorManager::GetInstance().ATCReportErrMessage("E11019", {"opname", "index"}, - {node->GetName(), std::to_string(in_anchor_ptr->GetIdx())}); + REPORT_INNER_ERROR("E19999", "Op:%s(%s)'s input %d is not linked, check invalid", + node->GetName().c_str(), node->GetType().c_str(), in_anchor_ptr->GetIdx()); GELOGE(ge::GRAPH_FAILED, "[Check][Param] Op[%s]'s input %d is not linked.", node->GetName().c_str(), in_anchor_ptr->GetIdx()); string check_msg = "input " + to_string(in_anchor_ptr->GetIdx()) + "is not linked in weight file"; @@ -2541,13 +2409,15 @@ Status CaffeWeightsParser::ConvertNetParameter(const NetParameter ¶m, ge::Co GE_CHK_BOOL_TRUE_EXEC_WITH_LOG( (op_parser.get() == nullptr), - ErrorManager::GetInstance().ATCReportErrMessage("E11025", {"opname", "optype"}, {layer_name, op_type}); + REPORT_INPUT_ERROR("E11009", std::vector({"opname", "optype"}), + std::vector({layer_name, op_type})); return FAILED, "[Create][OpParser] failed for Op[%s], optype is %s", layer_name.c_str(), op_type.c_str()); // Parsing weight information through op parser Status status = op_parser->ParseWeights(&layer, node); GE_CHK_BOOL_TRUE_EXEC_WITH_LOG( - (status != SUCCESS), ErrorManager::GetInstance().ATCReportErrMessage("E11026", {"opname"}, {layer_name}); + (status != SUCCESS), + REPORT_CALL_ERROR("E19999", "Parse weight for op:%s(%s) failed", layer_name.c_str(), op_type.c_str()); return status, "[Parse][Weights] for op[%s] failed", layer_name.c_str()); } } diff --git a/parser/caffe/caffe_parser.h b/parser/caffe/caffe_parser.h index 6df68e2..9a3af8b 100644 --- a/parser/caffe/caffe_parser.h +++ b/parser/caffe/caffe_parser.h @@ -164,35 +164,6 @@ class PARSER_FUNC_VISIBILITY CaffeModelParser : public domi::ModelParser { Status ParseNetModelByCustomProto(const char *model_path, const string &custom_proto_path, const string &custom_proto_name, std::vector &operators); - /* - * @ingroup domi_omg - * @brief Parse caffe proto file - * @param [in] proto_file, file path of caffe proto - * @param [out] identifier_op_map, identifer and op map - * @return SUCCESS parse successfully - * @return FAILED parse failed - */ - Status ParseProtoFile(const string &proto_file, std::map &identifier_op_map); - - /* - * @ingroup domi_omg - * @brief Save identifier op map info - * @param [in] line, line of proto - * @param [out] identifier_op_map, identifer and op map - * @return SUCCESS parse successfully - * @return FAILED parse failed - */ - Status SaveIdentifierOpMapInfo(const string &line, std::map &identifier_op_map); - - /* - * @ingroup domi_omg - * @brief Get op identifier - * @param [in] line, line of proto - * @param [out] identifier, identifer of op - * @return SUCCESS parse successfully - * @return FAILED parse failed - */ - Status GetIdentifier(const std::string &line, int32_t &identifier); /* * @ingroup domi_omg * @brief Read caffe model and shield google warning diff --git a/parser/common/acl_graph_parser_util.cc b/parser/common/acl_graph_parser_util.cc index 9040942..731159d 100644 --- a/parser/common/acl_graph_parser_util.cc +++ b/parser/common/acl_graph_parser_util.cc @@ -657,8 +657,8 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY long GetFileLength(const std::s std::string real_path = RealPath(input_file.c_str()); GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(real_path.empty(), - REPORT_CALL_ERROR("E19999", "input_file path '%s' not valid, realpath failed", - input_file.c_str()); + REPORT_INPUT_ERROR("E19000", std::vector({"path", "errmsg"}), + std::vector({real_path, strerror(errno)})); return -1, "[Get][Path] input_file path '%s' not valid", input_file.c_str()); unsigned long long file_length = 0; GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(mmGetFileSize(input_file.c_str(), &file_length) != EN_OK, @@ -666,15 +666,12 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY long GetFileLength(const std::s {input_file, strerror(errno)}); return -1, "[Open][File] [%s] failed. %s", input_file.c_str(), strerror(errno)); - GE_CHK_BOOL_TRUE_EXEC_WITH_LOG((file_length == 0), - ErrorManager::GetInstance().ATCReportErrMessage("E19015", {"filepath"}, {input_file}); - return -1, "[Check][Param] File[%s] size is 0, not valid.", input_file.c_str()); - - GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(file_length > kMaxFileSizeLimit, - ErrorManager::GetInstance().ATCReportErrMessage( - "E19016", {"filepath", "filesize", "maxlen"}, - {input_file, std::to_string(file_length), std::to_string(kMaxFileSizeLimit)}); - return -1, "[Check][Param] File[%s] size %lld is out of limit: %d.", + GE_CHK_BOOL_TRUE_EXEC_WITH_LOG((file_length == 0 || file_length > kMaxFileSizeLimit), + REPORT_INPUT_ERROR( + "E19015", std::vector({"file", "size", "maxsize"}), + std::vector({input_file, std::to_string(file_length), + std::to_string(kMaxFileSizeLimit)})); + return -1, "[Check][Param] File[%s] size %lld is out of range(0,%d).", input_file.c_str(), file_length, kMaxFileSizeLimit); return static_cast(file_length); } @@ -806,7 +803,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY bool ReadProtoFromText(const ch std::ifstream fs(real_path.c_str(), std::ifstream::in); if (!fs.is_open()) { - ErrorManager::GetInstance().ATCReportErrMessage("E19017", {"realpth", "protofile"}, {real_path, file}); + REPORT_INNER_ERROR("E19999", "open file:%s failed", real_path.c_str()); GELOGE(ge::FAILED, "[Open][ProtoFile] failed, real path is '%s' when orginal file path is '%s'.", real_path.c_str(), file); return false; diff --git a/parser/common/model_saver.cc b/parser/common/model_saver.cc index 3e86c2f..f17380d 100644 --- a/parser/common/model_saver.cc +++ b/parser/common/model_saver.cc @@ -43,11 +43,11 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelSaver::SaveJsonToFi try { model_str = model.dump(kInteval, ' ', false, Json::error_handler_t::ignore); } catch (std::exception &e) { - ErrorManager::GetInstance().ATCReportErrMessage("E19007", {"exception"}, {e.what()}); + REPORT_INNER_ERROR("E19999", "Failed to convert JSON to string, reason: %s, savefile:%s.", e.what(), file_path); GELOGE(FAILED, "[Invoke][Dump] Failed to convert JSON to string, reason: %s, savefile:%s.", e.what(), file_path); return FAILED; } catch (...) { - ErrorManager::GetInstance().ATCReportErrMessage("E19008"); + REPORT_INNER_ERROR("E19999", "Failed to convert JSON to string, savefile:%s.", file_path); GELOGE(FAILED, "[Invoke][Dump] Failed to convert JSON to string, savefile:%s.", file_path); return FAILED; } @@ -136,7 +136,9 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY int ModelSaver::CreateDirectory int32_t ret = mmMkdir(tmp_dir_path, S_IRUSR | S_IWUSR | S_IXUSR); // 700 if (ret != 0) { if (errno != EEXIST) { - ErrorManager::GetInstance().ATCReportErrMessage("E19006", {"path"}, {directory_path}); + REPORT_CALL_ERROR("E19999", + "Can not create directory %s. Make sure the directory exists and writable. errmsg:%s", + directory_path.c_str(), strerror(errno)); GELOGW("Can not create directory %s. Make sure the directory exists and writable. errmsg:%s", directory_path.c_str(), strerror(errno)); return ret; @@ -148,7 +150,9 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY int ModelSaver::CreateDirectory int32_t ret = mmMkdir(const_cast(directory_path.c_str()), S_IRUSR | S_IWUSR | S_IXUSR); // 700 if (ret != 0) { if (errno != EEXIST) { - ErrorManager::GetInstance().ATCReportErrMessage("E19006", {"path"}, {directory_path}); + REPORT_CALL_ERROR("E19999", + "Can not create directory %s. Make sure the directory exists and writable. errmsg:%s", + directory_path.c_str(), strerror(errno)); GELOGW("Can not create directory %s. Make sure the directory exists and writable. errmsg:%s", directory_path.c_str(), strerror(errno)); return ret; diff --git a/parser/onnx/onnx_parser.cc b/parser/onnx/onnx_parser.cc index e6b9d0b..cc69799 100644 --- a/parser/onnx/onnx_parser.cc +++ b/parser/onnx/onnx_parser.cc @@ -259,9 +259,8 @@ Status PostOpProcessForSubgraph(const ParseArg &arg, ge::ComputeGraphPtr sub_gra Status OnnxModelParser::ParseOutput(ge::onnx::GraphProto &onnx_graph) { if (onnx_graph.output_size() == 0) { - ErrorManager::GetInstance().ATCReportErrMessage("E16001"); GELOGE(FAILED, "[Parse][Output] Onnx graph:%s has zero output", onnx_graph.name().c_str()); - REPORT_INNER_ERROR("E19999", "Onnx graph:%s has zero output", onnx_graph.name().c_str()); + REPORT_INPUT_ERROR("E16001", std::vector({"value"}), std::vector({"output"})); return FAILED; } @@ -277,9 +276,8 @@ Status OnnxModelParser::ParseOutput(ge::onnx::GraphProto &onnx_graph) { Status OnnxModelParser::ParseInput(const std::map &initializer_name_tensor, bool is_subgraph, ge::onnx::GraphProto &onnx_graph) { if (!is_subgraph && onnx_graph.input_size() == 0) { - ErrorManager::GetInstance().ATCReportErrMessage("E16001"); GELOGE(FAILED, "[Parse][Input] Root onnx graph:%s has zero input", onnx_graph.name().c_str()); - REPORT_INNER_ERROR("E19999", "Root onnx graph:%s has zero input", onnx_graph.name().c_str()); + REPORT_INPUT_ERROR("E16001", std::vector({"value"}), std::vector({"input"})); return FAILED; } @@ -448,10 +446,10 @@ Status OnnxModelParser::TransNodeToOperator(const ge::onnx::NodeProto *node_prot string node_name = node_proto->name(); op = ge::OperatorFactory::CreateOperator(node_name, op_type); if (op.GetName() != node_name) { - ErrorManager::GetInstance().ATCReportErrMessage("E16003", {"opname", "optype"}, {node_name, op_type}); + REPORT_INPUT_ERROR("E10501", std::vector({"opname", "optype"}), + std::vector({node_name, op_type})); GELOGE(INTERNAL_ERROR, "[Creat][Op] IR for op[%s] optype[%s] is not registered.", node_name.c_str(), op_type.c_str()); - REPORT_INNER_ERROR("E19999", "IR for op[%s] optype[%s] is not registered.", node_name.c_str(), op_type.c_str()); return INTERNAL_ERROR; } @@ -678,8 +676,7 @@ Status OnnxModelParser::GetModelFromFile(const char *file, ge::onnx::ModelProto // 1. Get graph from onnx model file. if (!ge::parser::ReadProtoFromBinaryFile(file, &onnx_model)) { - ErrorManager::GetInstance().ATCReportErrMessage( - "E19021", {"reason"}, {"Read onnx model file failed."}); + REPORT_CALL_ERROR("E19999", "Read onnx model file:%s failed.", file); GELOGE(PARAM_INVALID, "[Read][ModeFile] failed."); return FAILED; } @@ -691,8 +688,7 @@ Status OnnxModelParser::GetModelFromMemory(const char *data, uint32_t size, ge:: // 1. Get graph from onnx model file. if (!ge::parser::ReadProtoFromArray(data, size, &onnx_model)) { - ErrorManager::GetInstance().ATCReportErrMessage( - "E19021", {"reason"}, {"Read onnx model from memory failed."}); + REPORT_CALL_ERROR("E19999", "Read onnx model from memory failed."); GELOGE(PARAM_INVALID, "[Read][OnnxModel] from memory failed."); return FAILED; } diff --git a/parser/tensorflow/scope/scope_pass_manager.cc b/parser/tensorflow/scope/scope_pass_manager.cc index f12b2bb..3973971 100644 --- a/parser/tensorflow/scope/scope_pass_manager.cc +++ b/parser/tensorflow/scope/scope_pass_manager.cc @@ -70,7 +70,7 @@ Status ScopePassManager::Run(shared_ptr &graph) { not_changed = false; } else if (status != domi::SCOPE_NOT_CHANGED) { // exception - ErrorManager::GetInstance().ATCReportErrMessage("E12003", {"passname"}, {pass->PassName()}); + REPORT_CALL_ERROR("E19999", "Run scope fusion pass [%s] failed.", pass->PassName().c_str()); GELOGE(FAILED, "Pass Run failed, pass name:%s", pass->PassName().c_str()); return status; } diff --git a/parser/tensorflow/tensorflow_fusionop_util.cc b/parser/tensorflow/tensorflow_fusionop_util.cc index b45d517..a2c786a 100644 --- a/parser/tensorflow/tensorflow_fusionop_util.cc +++ b/parser/tensorflow/tensorflow_fusionop_util.cc @@ -258,8 +258,8 @@ Status TensorFlowFunsionOPUtil::CheckFusionOpChildren(const string &fusion_node_ // Number matching of fusion operators auto iter_children_nums = tensorflow_fusionop_children_nums_map.find(funsion_op_type); if (iter_children_nums == tensorflow_fusionop_children_nums_map.end()) { - ErrorManager::GetInstance().ATCReportErrMessage( - "E12018", {"opname", "optype"}, {fusion_node_name, funsion_op_type}); + REPORT_INNER_ERROR("E19999", "Op[%s]'s optype[%s] not a Fusion OP, check invalid", + fusion_node_name.c_str(), funsion_op_type.c_str()); GELOGE(domi::INTERNAL_ERROR, "Op[%s]'s optype[%s] not a Fusion OP!", fusion_node_name.c_str(), funsion_op_type.c_str()); return domi::INTERNAL_ERROR; @@ -276,8 +276,8 @@ Status TensorFlowFunsionOPUtil::CheckFusionOpChildren(const string &fusion_node_ } if (!find) { - ErrorManager::GetInstance().ATCReportErrMessage("E12019", - {"opname", "optype", "childrennum"}, {fusion_node_name, funsion_op_type, std::to_string(children_num)}); + REPORT_INNER_ERROR("E19999", "CheckFusionOp op[%s]'s optype[%s] children_nums[%d] is not the same for define", + fusion_node_name.c_str(), funsion_op_type.c_str(), children_num); GELOGE(domi::INTERNAL_ERROR, "Op[%s]'s optype[%s] children_nums:%d is not the same for define.", fusion_node_name.c_str(), @@ -306,8 +306,8 @@ Status TensorFlowFunsionOPUtil::CheckFusionOpChildren(const string &fusion_node_ } GE_IF_BOOL_EXEC(count != children_names.size(), - ErrorManager::GetInstance().ATCReportErrMessage( - "E12020", {"opname", "optype"}, {fusion_node_name, funsion_op_type}); + REPORT_INNER_ERROR("E19999", "Op[%s]'s optype[%s] has no enough importance child.", fusion_node_name.c_str(), + funsion_op_type.c_str()); GELOGE(domi::INTERNAL_ERROR, "Op[%s]'s optype[%s] has no enough importance child.", fusion_node_name.c_str(), funsion_op_type.c_str()); return domi::INTERNAL_ERROR;); diff --git a/parser/tensorflow/tensorflow_parser.cc b/parser/tensorflow/tensorflow_parser.cc index 9352885..001d6df 100644 --- a/parser/tensorflow/tensorflow_parser.cc +++ b/parser/tensorflow/tensorflow_parser.cc @@ -374,7 +374,7 @@ Status TensorFlowModelParser::TransNodeToOpDesc(const domi::tensorflow::NodeDef GE_RETURN_IF_ERROR(DefunToPartitionedCall(node_def, op)); GE_CHECK_NOTNULL(op); } else { - ErrorManager::GetInstance().ATCReportErrMessage("E12011", {"opname", "optype"}, {node_name, op_type}); + ErrorManager::GetInstance().ATCReportErrMessage("E10501", {"opname", "optype"}, {node_name, op_type}); GELOGE(INTERNAL_ERROR, "IR for op[%s] optype[%s] is not registered.", node_name.c_str(), op_type.c_str()); return FAILED; } @@ -727,9 +727,9 @@ Status TensorFlowModelParser::AddEdges(ge::ComputeGraphPtr &graph) { ge::NodePtr dest = iter1->second; GE_CHECK_NOTNULL(dest); if (src_output_iter.second.size() != input_iter->second.size()) { - ErrorManager::GetInstance().ATCReportErrMessage("E12021", {"opname1", "index1", "opname2", "index2"}, - {src_op_name, std::to_string(input_iter->second.size()), - dest_op_name, std::to_string(src_output_iter.second.size())}); + REPORT_INNER_ERROR("E19999", "Input size of op[%s]:%zu is not equal to Output size of op[%s]:%zu.", + src_op_name.c_str(), input_iter->second.size(), + dest_op_name.c_str(), src_output_iter.second.size()); GELOGE(INTERNAL_ERROR, "Input size of op[%s]:%zu is not equal to Output size of op[%s]:%zu.", src_op_name.c_str(), input_iter->second.size(), dest_op_name.c_str(), src_output_iter.second.size()); return INTERNAL_ERROR; @@ -746,8 +746,8 @@ Status TensorFlowModelParser::AddEdges(ge::ComputeGraphPtr &graph) { ge::InDataAnchorPtr in_archor_ptr = dest->GetInDataAnchor(outputpair.second); GE_CHECK_NOTNULL(in_archor_ptr); GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(ge::GraphUtils::AddEdge(out_archor_ptr, in_archor_ptr) != ge::GRAPH_SUCCESS, - ErrorManager::GetInstance().ATCReportErrMessage( - "E12014", {"opname1", "opname2"}, {src->GetName(), dest->GetName()}); + REPORT_INNER_ERROR("E19999", "Add link from op:%s to op:%s failed", + src->GetName().c_str(), dest->GetName().c_str()); return INTERNAL_ERROR, "Add link failed from op[%s] to op[%s].", src->GetName().c_str(), dest->GetName().c_str()); } else { @@ -758,8 +758,8 @@ Status TensorFlowModelParser::AddEdges(ge::ComputeGraphPtr &graph) { GE_CHECK_NOTNULL(out_archor_ptr); GE_CHK_BOOL_TRUE_EXEC_WITH_LOG( ge::GraphUtils::AddEdge(out_archor_ptr, in_archor_ptr) != ge::GRAPH_SUCCESS, - ErrorManager::GetInstance().ATCReportErrMessage("E12014", {"opname1", "opname2"}, - {src->GetName(), dest->GetName()}); + REPORT_INNER_ERROR("E19999", "Add link from op:%s to op:%s failed", + src->GetName().c_str(), dest->GetName().c_str()); return INTERNAL_ERROR, "Add link failed from op[%s] to op[%s].", src->GetName().c_str(), dest->GetName().c_str() ); @@ -918,7 +918,7 @@ Status TensorFlowModelParser::ParseNodeDef(TensorFlowModelParser *parser, ge::Co } return SUCCESS; } else { - REPORT_INPUT_ERROR("E12011", std::vector({"opname", "optype"}), + REPORT_INPUT_ERROR("E10501", std::vector({"opname", "optype"}), std::vector({node_name, op_type})); GELOGE(INTERNAL_ERROR, "op[%s] type[%s] have no ir factory.]", node_name.c_str(), op_type.c_str()); return FAILED; @@ -1361,7 +1361,7 @@ Status TensorFlowModelParser::Parse(const char *model_path, ge::ComputeGraphPtr ret = GenSubgraphParseTasks(arg.graph, tasks); if (ret != SUCCESS) { - ErrorManager::GetInstance().ATCReportErrMessage("E12017", {"graphname"}, {arg.graph->GetName()}); + REPORT_CALL_ERROR("E19999", "Failed to gen tasks on graph:%s for next iteration", arg.graph->GetName().c_str()); GELOGE(ret, "Failed to gen tasks on graph %s for next iteration", arg.graph->GetName().c_str()); return ret; } @@ -1682,13 +1682,13 @@ Status TensorFlowModelParser::RunScopeFusionPass(const vector &scope_pas for (auto &pass_name : scope_passes_list) { auto pass = impl->CreateScopeFusionPass(pass_name); if (pass == nullptr) { - ErrorManager::GetInstance().ATCReportErrMessage("E12001", {"passname"}, {pass_name}); + REPORT_INNER_ERROR("E19999", "Scope fusion pass[%s] is not registered.", pass_name.c_str()); GELOGE(INTERNAL_ERROR, "Scope fusion pass[%s] is not registered.", pass_name.c_str()); return INTERNAL_ERROR; } Status ret = pass_manager.AddPass(pass); if (ret != SUCCESS) { - ErrorManager::GetInstance().ATCReportErrMessage("E12002", {"passname"}, {pass_name}); + REPORT_CALL_ERROR("E19999", "Add scope fusion pass[%s] failed.", pass_name.c_str()); GELOGE(INTERNAL_ERROR, "Add scope fusion pass[%s] failed.", pass_name.c_str()); return INTERNAL_ERROR; } @@ -3085,8 +3085,9 @@ Status TensorFlowModelParser::TrimGraphByInput(const domi::tensorflow::GraphDef std::set next_inputs; for (const string ¤t_input : current_inputs) { delete_nodes.insert(current_input); - GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(!node_lookup.count(current_input), ErrorManager::GetInstance().ATCReportErrMessage( - "E12012", {"opname"}, {current_input}); + GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(!node_lookup.count(current_input), + ErrorManager::GetInstance().ATCReportErrMessage( + "E10016", {"parameter", "opname"}, {"input_shape", current_input}); return FAILED, "Input op[%s] not found in graph.", current_input.c_str()); const NodeDef *current_node = node_lookup[current_input]; GE_CHECK_NOTNULL(current_node); @@ -3161,8 +3162,9 @@ Status TensorFlowModelParser::TrimGraphByOutput(const domi::tensorflow::GraphDef for (const string ¤t_input : current_inputs) { required_nodes.insert(current_input); GE_IF_BOOL_EXEC(input_nodes.count(current_input), continue); - GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(!node_lookup.count(current_input), ErrorManager::GetInstance().ATCReportErrMessage( - "E12012", {"opname"}, {current_input}); + GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(!node_lookup.count(current_input), + ErrorManager::GetInstance().ATCReportErrMessage( + "E10016", {"parameter", "opname"}, {"out_nodes", current_input}); return FAILED, "Input op[%s] not found in graph.", current_input.c_str()); const NodeDef *current_node = node_lookup[current_input]; GE_CHECK_NOTNULL(current_node); @@ -3356,7 +3358,8 @@ Status TensorFlowModelParser::OptimizeConstNodes4CustomOp(domi::tensorflow::Grap if (it.moveType == domi::OMG_REMOVE_TYPE_WITH_COND) { domi::tensorflow::AttrValue attr_value; GE_IF_BOOL_EXEC(!(ge::TensorFlowUtil::FindAttrValue(current_node, it.attrName, attr_value)), - ErrorManager::GetInstance().ATCReportErrMessage("E12005", {"attrname"}, {current_op_name}); + REPORT_INNER_ERROR("E19999", "Op:%s register AttrName[%s] has no value, check invalid", + current_op_name.c_str(), it.attrName.c_str()); GELOGE(INTERNAL_ERROR, "AttrName[%s] has no value!", it.attrName.c_str()); return PARAM_INVALID); GE_IF_BOOL_EXEC(attr_value.b() == it.attrValue, unused_inputs.insert(move_index)); @@ -3390,7 +3393,7 @@ Status TensorFlowModelParser::OptimizeConstNodes4CustomOp(domi::tensorflow::Grap // 2.4 remove the input const nodes Status ret = RemoveInputs(graph_def, current_node, unused_inputs, all_nodedef_map); if (ret != SUCCESS) { - ErrorManager::GetInstance().ATCReportErrMessage("E12006", {"opname"}, {current_op_name}); + REPORT_CALL_ERROR("E19999", "remove input for op:%s failed", current_op_name.c_str()); GELOGE(INTERNAL_ERROR, "Op[%s] remove input failed.", current_op_name.c_str()); return ret; } @@ -3897,7 +3900,8 @@ Status TensorFlowModelParser::AddFusionNodeDef(shared_ptr &scope } else { Status ret = AddFusionInnerNodeDef(scope_graph, op_node_name, node_name_list_new); if (ret != SUCCESS) { - ErrorManager::GetInstance().ATCReportErrMessage("E12028", {"opname"}, {op_node_name}); + REPORT_INNER_ERROR("E19999", "Failed to add fusion inner nodes for fusion op:%s, " + "please check FusionScopesResult set in scope fusion pass", op_node_name.c_str()); GELOGE(ret, "Failed to add fusion inner node, fusion_op_name:%s.", op_node_name.c_str()); return ret; }