| @@ -1 +1 @@ | |||
| Subproject commit 6850ed726c581ae81a97952156b51273380420bc | |||
| Subproject commit 22ab76ecd8461f679606374be4b3b6b6f7cad321 | |||
| @@ -74,7 +74,7 @@ using std::ifstream; | |||
| namespace ge { | |||
| graphStatus aclgrphParseCaffe(const char *model_file, const char *weights_file, ge::Graph &graph) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kParser); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kParser); | |||
| GE_CHECK_NOTNULL(model_file); | |||
| GetParserContext().type = domi::CAFFE; | |||
| std::map<string, string> options; | |||
| @@ -128,7 +128,7 @@ graphStatus aclgrphParseCaffe(const char *model_file, const char *weights_file, | |||
| graphStatus aclgrphParseCaffe(const char *model_file, const char *weights_file, | |||
| const std::map<AscendString, AscendString> &parser_params, ge::Graph &graph) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kParser); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kParser); | |||
| GE_CHECK_NOTNULL(model_file); | |||
| GetParserContext().type = domi::CAFFE; | |||
| std::map<string, string> options; | |||
| @@ -558,8 +558,8 @@ Status CaffeModelParser::ParseProtoFile(const string &proto_file, std::map<int32 | |||
| 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"}, {"STDERR_FILENO"}); | |||
| GELOGE(FAILED, "[Invoke][Dup] failed: %d.", copy_fd); | |||
| ErrorManager::GetInstance().ATCReportErrMessage("E19020", {"file", "errmsg"}, {"STDERR_FILENO", strerror(errno)}); | |||
| GELOGE(FAILED, "[Invoke][Dup] failed:%d, reason:%s", copy_fd, strerror(errno)); | |||
| return FAILED; | |||
| } | |||
| @@ -567,15 +567,15 @@ Status CaffeModelParser::ReadModelWithoutWarning(const char *model_path, google: | |||
| if (fd < 0) { | |||
| (void)mmClose(copy_fd); | |||
| ErrorManager::GetInstance().ATCReportErrMessage("E19001", {"file", "errmsg"}, {kDevNull, strerror(errno)}); | |||
| GELOGE(FAILED, "[Open][File] %s failed.", kDevNull); | |||
| GELOGE(FAILED, "[Open][File] %s failed. reason:%s", kDevNull, strerror(errno)); | |||
| return FAILED; | |||
| } | |||
| if (mmDup2(fd, STDERR_FILENO) < 0) { | |||
| (void)mmClose(fd); | |||
| (void)mmClose(copy_fd); | |||
| ErrorManager::GetInstance().ATCReportErrMessage("E19020", {"file"}, {"STDERR_FILENO"}); | |||
| GELOGE(FAILED, "[Invoke][Dup2] Re-orient failed."); | |||
| ErrorManager::GetInstance().ATCReportErrMessage("E19020", {"file", "errmsg"}, {"STDERR_FILENO", strerror(errno)}); | |||
| GELOGE(FAILED, "[Invoke][Dup2] Re-orient failed. reason:%s", strerror(errno)); | |||
| return FAILED; | |||
| } | |||
| @@ -589,8 +589,8 @@ 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"}, {"STDERR_FILENO"}); | |||
| GELOGE(FAILED, "[Invoke][Dup2] Re-orient failed."); | |||
| ErrorManager::GetInstance().ATCReportErrMessage("E19020", {"file", "errmsg"}, {"STDERR_FILENO", strerror(errno)}); | |||
| GELOGE(FAILED, "[Invoke][Dup2] Re-orient failed. reason:%s", strerror(errno)); | |||
| return FAILED; | |||
| } | |||
| (void)mmClose(fd); | |||
| @@ -1483,7 +1483,7 @@ Status CaffeModelParser::PreCheck(const domi::caffe::NetParameter &net) { | |||
| } | |||
| Status CaffeModelParser::ParseFromMemory(const char *data, uint32_t size, ge::ComputeGraphPtr &graph) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kParser); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kParser); | |||
| bool has_error = false; | |||
| GE_CHK_BOOL_RET_STATUS(data != nullptr, FAILED, "[Check][Param]model data is nullptr."); | |||
| @@ -1614,7 +1614,7 @@ Status CaffeModelParser::ParseFromMemory(const char *data, uint32_t size, ge::Co | |||
| } | |||
| Status CaffeModelParser::Parse(const char *model_path, ge::Graph &graph) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kParser); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kParser); | |||
| GE_CHECK_NOTNULL(model_path); | |||
| ge::ComputeGraphPtr compute_graph = ge::GraphUtils::GetComputeGraph(graph); | |||
| GE_CHECK_NOTNULL(compute_graph); | |||
| @@ -1904,7 +1904,7 @@ Status CaffeModelParser::ReorderInput(domi::caffe::NetParameter &net) { | |||
| } | |||
| Status CaffeWeightsParser::ParseFromMemory(const char *data, uint32_t size, ge::ComputeGraphPtr &graph) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kParser); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kParser); | |||
| if (data == nullptr) { | |||
| REPORT_INNER_ERROR("E19999", "param data is nullptr."); | |||
| GELOGE(PARAM_INVALID, "[Check][Param]Caffe weights data is nullptr"); | |||
| @@ -1935,7 +1935,7 @@ Status CaffeWeightsParser::ParseFromMemory(const char *data, uint32_t size, ge:: | |||
| } | |||
| Status CaffeWeightsParser::Parse(const char *file, ge::Graph &graph) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kParser); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kParser); | |||
| GE_CHECK_NOTNULL(file); | |||
| ge::ComputeGraphPtr compute_graph = ge::GraphUtils::GetComputeGraph(graph); | |||
| GE_CHECK_NOTNULL(compute_graph); | |||
| @@ -81,8 +81,8 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelSaver::SaveJsonToFi | |||
| } | |||
| // Close file | |||
| if (mmClose(fd) != EN_OK) { | |||
| REPORT_INNER_ERROR("E19999", "close file:%s failed", file_path); | |||
| GELOGE(FAILED, "[Close][File] %s failed.", file_path); | |||
| REPORT_INNER_ERROR("E19999", "close file:%s failed. errmsg:%s", file_path, strerror(errno)); | |||
| GELOGE(FAILED, "[Close][File] %s failed. errmsg:%s", file_path, strerror(errno)); | |||
| ret = FAILED; | |||
| } | |||
| return ret; | |||
| @@ -137,8 +137,8 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY int ModelSaver::CreateDirectory | |||
| if (ret != 0) { | |||
| if (errno != EEXIST) { | |||
| ErrorManager::GetInstance().ATCReportErrMessage("E19006", {"path"}, {directory_path}); | |||
| GELOGW("Can not create directory %s. Make sure the directory exists and writable.", | |||
| directory_path.c_str()); | |||
| GELOGW("Can not create directory %s. Make sure the directory exists and writable. errmsg:%s", | |||
| directory_path.c_str(), strerror(errno)); | |||
| return ret; | |||
| } | |||
| } | |||
| @@ -149,7 +149,8 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY int ModelSaver::CreateDirectory | |||
| if (ret != 0) { | |||
| if (errno != EEXIST) { | |||
| ErrorManager::GetInstance().ATCReportErrMessage("E19006", {"path"}, {directory_path}); | |||
| GELOGW("Can not create directory %s. Make sure the directory exists and writable.", directory_path.c_str()); | |||
| GELOGW("Can not create directory %s. Make sure the directory exists and writable. errmsg:%s", | |||
| directory_path.c_str(), strerror(errno)); | |||
| return ret; | |||
| } | |||
| } | |||
| @@ -74,12 +74,13 @@ | |||
| } while (0) | |||
| // Check if the parameter is null. If yes, return PARAM_INVALID and record the error | |||
| #define GE_CHECK_NOTNULL(val) \ | |||
| do { \ | |||
| if (val == nullptr) { \ | |||
| GELOGE(ge::FAILED, "param[%s] must not be null.", #val); \ | |||
| return ge::PARAM_INVALID; \ | |||
| } \ | |||
| #define GE_CHECK_NOTNULL(val) \ | |||
| do { \ | |||
| if (val == nullptr) { \ | |||
| GELOGE(ge::FAILED, "param[%s] must not be null.", #val); \ | |||
| REPORT_INNER_ERROR("E19999", "Param:%s is nullptr, check invalid", #val); \ | |||
| return ge::PARAM_INVALID; \ | |||
| } \ | |||
| } while (0) | |||
| // Check whether the parameter is null. If so, execute the exec_expr expression and record the error log | |||
| @@ -936,7 +936,7 @@ Status OnnxModelParser::ModelParseToGraphImpl(bool is_subgraph, ge::onnx::GraphP | |||
| } | |||
| Status OnnxModelParser::Parse(const char *file, ge::Graph &graph) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kParser); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kParser); | |||
| ge::onnx::ModelProto onnx_model; | |||
| Status ret = GetModelFromFile(file, onnx_model); | |||
| if (ret != SUCCESS) { | |||
| @@ -952,7 +952,7 @@ Status OnnxModelParser::Parse(const char *file, ge::Graph &graph) { | |||
| } | |||
| Status OnnxModelParser::ParseFromMemory(const char *data, uint32_t size, ge::Graph &graph) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kParser); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kParser); | |||
| ge::onnx::ModelProto onnx_model; | |||
| Status ret = GetModelFromMemory(data, size, onnx_model); | |||
| if (ret != SUCCESS) { | |||
| @@ -92,6 +92,7 @@ domi::Status ComputeArgRange(const domi::tensorflow::NodeDef &node_def, const do | |||
| GE_IF_BOOL_EXEC( | |||
| !GraphToFunctionDef::FindAttrValue(&node_def, arg_def.number_attr(), attr_value), | |||
| GELOGE(domi::INTERNAL_ERROR, "In NodeDef %s Attr number_attr is not exist.", node_def.name().c_str()); | |||
| REPORT_INNER_ERROR("E19999", "Attr:number_attr not exist in node:%s, check invalid", node_def.name().c_str()); | |||
| return domi::INTERNAL_ERROR); | |||
| *num = attr_value.i(); | |||
| } else if (!arg_def.type_list_attr().empty()) { | |||
| @@ -101,12 +102,15 @@ domi::Status ComputeArgRange(const domi::tensorflow::NodeDef &node_def, const do | |||
| GE_IF_BOOL_EXEC( | |||
| !GraphToFunctionDef::FindAttrValue(&node_def, arg_def.type_list_attr(), attr_value), | |||
| GELOGE(domi::INTERNAL_ERROR, "In NodeDef %s Attr type_list_attr is not exist.", node_def.name().c_str()); | |||
| REPORT_INNER_ERROR("E19999", "Attr:type_list_attr not exist in node:%s, check invalid", node_def.name().c_str()); | |||
| return domi::INTERNAL_ERROR); | |||
| *num = attr_value.list().type_size(); | |||
| } else if ((!arg_def.type_attr().empty()) || (arg_def.type() != DT_INVALID)) { | |||
| *num = 1; | |||
| } else { | |||
| GELOGE(domi::INTERNAL_ERROR, "In NodeDef %s Attr type_list_attr is not exist.", node_def.name().c_str()); | |||
| REPORT_INNER_ERROR("E19999", "arg_def for node:%s is invalid, number_attr type_list_attr type_attr all empty", | |||
| node_def.name().c_str()); | |||
| return domi::INTERNAL_ERROR; | |||
| } | |||
| return SUCCESS; | |||
| @@ -143,6 +147,8 @@ domi::Status RemapFunctionDef(FunctionDef *fdef, const string &name, NameMapHelp | |||
| for (int i = 0; i < fdef->signature().input_arg_size(); ++i) { | |||
| const string &input_name = fdef->signature().input_arg(i).name(); | |||
| GE_IF_BOOL_EXEC(input_name.empty(), | |||
| REPORT_INNER_ERROR("E19999", "In fdef %s, index:%d input_name is empty, check invalid", | |||
| fdef->signature().name().c_str(), i); | |||
| GELOGE(domi::INTERNAL_ERROR, "In fdef %s input_name null .", fdef->signature().name().c_str()); | |||
| return domi::INTERNAL_ERROR); | |||
| } | |||
| @@ -157,6 +163,8 @@ domi::Status RemapFunctionDef(FunctionDef *fdef, const string &name, NameMapHelp | |||
| const string normalized = node_names.Renormalize(node_def->input(i).substr(1)); | |||
| GE_IF_BOOL_EXEC(normalized.empty(), | |||
| REPORT_INNER_ERROR("E19999", "Could not remap control input %s of node %s in function %s", | |||
| node_def->input(i).c_str(), node_def->name().c_str(), name.c_str()); | |||
| GELOGE(domi::INTERNAL_ERROR, "Could not remap control input %s of node %s in function %s .", | |||
| node_def->input(i).c_str(), node_def->name().c_str(), name.c_str()); | |||
| return domi::INTERNAL_ERROR); | |||
| @@ -166,6 +174,8 @@ domi::Status RemapFunctionDef(FunctionDef *fdef, const string &name, NameMapHelp | |||
| const auto iter = tensor_renaming.find(node_def->input(i)); | |||
| GE_IF_BOOL_EXEC(iter == tensor_renaming.end(), | |||
| REPORT_INNER_ERROR("E19999", "Could not remap input %s of node %s in function %s", | |||
| node_def->input(i).c_str(), node_def->name().c_str(), name.c_str()); | |||
| GELOGE(domi::INTERNAL_ERROR, "Could not remap input %s of node %s in function %s .", | |||
| node_def->input(i).c_str(), node_def->name().c_str(), name.c_str()); | |||
| return domi::INTERNAL_ERROR); | |||
| @@ -180,19 +190,25 @@ domi::Status RemapFunctionDef(FunctionDef *fdef, const string &name, NameMapHelp | |||
| const string &ret_name = fdef->signature().output_arg(r).name(); | |||
| GE_IF_BOOL_EXEC(ret_name.empty(), | |||
| REPORT_INNER_ERROR("E19999", "Missing output %d to function %s", r, name.c_str()); | |||
| GELOGE(domi::INTERNAL_ERROR, "Missing output %d to function %s .", r, name.c_str()); | |||
| return domi::INTERNAL_ERROR); | |||
| const string &return_value = return_values[ret_name]; | |||
| GE_IF_BOOL_EXEC(return_value.empty(), | |||
| REPORT_INNER_ERROR("E19999", "Could not remap return value %d ,%s of %s in function %s", r, | |||
| ret_name.c_str(), return_value.c_str(), name.c_str()); | |||
| GELOGE(domi::INTERNAL_ERROR, "Could not remap return value %d ,%s of %s in function %s .", r, | |||
| ret_name.c_str(), return_value.c_str(), name.c_str()); | |||
| return domi::INTERNAL_ERROR); | |||
| const auto iter = tensor_renaming.find(return_value); | |||
| GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(iter == tensor_renaming.end(), return domi::INTERNAL_ERROR, | |||
| GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(iter == tensor_renaming.end(), | |||
| REPORT_INNER_ERROR("E19999", "can not find value[%s] in tensor_renaming map", | |||
| return_value.c_str()); | |||
| return domi::INTERNAL_ERROR, | |||
| "can not find value[%s] in tensor_renaming map.", return_value.c_str()); | |||
| (*fdef->mutable_ret())[ret_name] = iter->second; | |||
| @@ -213,6 +229,9 @@ domi::Status GraphToFunctionDef::RecordResult(ge::ComputeGraphPtr graph, | |||
| int32_t type = anchor->GetOwnerNode()->GetOpDesc()->GetOutputDesc(anchor->GetIdx()).GetDataType(); | |||
| auto iter = GE_TENSORFLOW_DATA_TYPE_MAP.find(type); | |||
| GE_IF_BOOL_EXEC(iter == GE_TENSORFLOW_DATA_TYPE_MAP.end(), | |||
| REPORT_INNER_ERROR("E19999", "datatype:%d of output:%d in node:%s:%s is not supported", | |||
| type, anchor->GetIdx(), anchor->GetOwnerNode()->GetName().c_str(), | |||
| anchor->GetOwnerNode()->GetName().c_str()); | |||
| GELOGE(PARAM_INVALID, "data_type %d not supported", type); | |||
| return PARAM_INVALID); | |||
| int32_t dtype = iter->second; | |||
| @@ -222,11 +241,13 @@ domi::Status GraphToFunctionDef::RecordResult(ge::ComputeGraphPtr graph, | |||
| GE_MAKE_SHARED(op = std::make_shared<ge::OpDesc>(op_name, ge::parser::NETOUTPUT), return FAILED); | |||
| graphStatus status = op->AddInputDesc(ge::GeTensorDesc()); | |||
| if (status != GRAPH_SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Add input desc to op:%s(%s) failed", op->GetName().c_str(), op->GetType().c_str()); | |||
| GELOGE(FAILED, "Add input desc for op:%s failed.", op->GetName().c_str()); | |||
| return FAILED; | |||
| } | |||
| status = op->AddOutputDesc(ge::GeTensorDesc()); | |||
| if (status != GRAPH_SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Add output desc to op:%s(%s) failed", op->GetName().c_str(), op->GetType().c_str()); | |||
| GELOGE(FAILED, "Add output desc for op:%s failed.", op->GetName().c_str()); | |||
| return FAILED; | |||
| } | |||
| @@ -244,6 +265,11 @@ domi::Status GraphToFunctionDef::RecordResult(ge::ComputeGraphPtr graph, | |||
| GE_CHECK_NOTNULL(in_archor_ptr); | |||
| ge::graphStatus ret = ge::GraphUtils::AddEdge(out_archor_ptr, in_archor_ptr); | |||
| if (ret != ge::GRAPH_SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Add edge between op:%s(%s)(index:%d) and op:%s(%s)(index:%d) failed", | |||
| out_archor_ptr->GetOwnerNode()->GetName().c_str(), | |||
| out_archor_ptr->GetOwnerNode()->GetType().c_str(), out_archor_ptr->GetIdx(), | |||
| in_archor_ptr->GetOwnerNode()->GetName().c_str(), | |||
| in_archor_ptr->GetOwnerNode()->GetType().c_str(), in_archor_ptr->GetIdx()); | |||
| GELOGE(domi::INTERNAL_ERROR, "Add edge failed,src op:%s,dst op:%s", node->GetName().c_str(), | |||
| res_node->GetName().c_str()); | |||
| return FAILED; | |||
| @@ -251,7 +277,13 @@ domi::Status GraphToFunctionDef::RecordResult(ge::ComputeGraphPtr graph, | |||
| node_exists = true; | |||
| } | |||
| } | |||
| GE_IF_BOOL_EXEC(!node_exists, GELOGE(FAILED, "node not exists!"); return FAILED); | |||
| GE_IF_BOOL_EXEC(!node_exists, | |||
| GELOGE(FAILED, "node not exists!"); | |||
| REPORT_CALL_ERROR("E19999", "Node:%s(%s) not found in graph:%s, check invalid", | |||
| anchor->GetOwnerNode()->GetName().c_str(), | |||
| anchor->GetOwnerNode()->GetType().c_str(), | |||
| graph->GetName().c_str()); | |||
| return FAILED); | |||
| result_datetypes_.emplace_back(domi::tensorflow::DataType(dtype)); | |||
| index++; | |||
| @@ -274,6 +306,9 @@ domi::Status GraphToFunctionDef::RecordArg(ge::ComputeGraphPtr graph, const vect | |||
| int32_t type = tensor_desc_ptr->GetDataType(); | |||
| auto iter = GE_TENSORFLOW_DATA_TYPE_MAP.find(type); | |||
| GE_IF_BOOL_EXEC(iter == GE_TENSORFLOW_DATA_TYPE_MAP.end(), | |||
| REPORT_INNER_ERROR("E19999", "datatype:%d of input:%d in node:%s:%s is not supported", | |||
| type, anchor->GetIdx(), anchor->GetOwnerNode()->GetName().c_str(), | |||
| anchor->GetOwnerNode()->GetName().c_str()); | |||
| GELOGE(PARAM_INVALID, "data_type %d not supported", type); | |||
| return PARAM_INVALID); | |||
| int32_t dtype = iter->second; | |||
| @@ -285,6 +320,7 @@ domi::Status GraphToFunctionDef::RecordArg(ge::ComputeGraphPtr graph, const vect | |||
| GE_MAKE_SHARED(op = std::make_shared<ge::OpDesc>(op_name, ge::parser::DATA), return FAILED); | |||
| graphStatus status = op->AddOutputDesc(ge::GeTensorDesc()); | |||
| if (status != GRAPH_SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Add output desc to op:%s(%s) failed", op->GetName().c_str(), op->GetType().c_str()); | |||
| GELOGE(FAILED, "Add output desc for op:%s failed.", op->GetName().c_str()); | |||
| return FAILED; | |||
| } | |||
| @@ -303,6 +339,11 @@ domi::Status GraphToFunctionDef::RecordArg(ge::ComputeGraphPtr graph, const vect | |||
| (void)ge::GraphUtils::RemoveEdge(in_archor_ptr->GetPeerOutAnchor(), in_archor_ptr); | |||
| ge::graphStatus ret = ge::GraphUtils::AddEdge(out_archor_ptr, in_archor_ptr); | |||
| if (ret != ge::GRAPH_SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Add control edge between op:%s(%s)(index:%d) and op:%s(%s)(index:%d) failed", | |||
| out_archor_ptr->GetOwnerNode()->GetName().c_str(), | |||
| out_archor_ptr->GetOwnerNode()->GetType().c_str(), out_archor_ptr->GetIdx(), | |||
| in_archor_ptr->GetOwnerNode()->GetName().c_str(), | |||
| in_archor_ptr->GetOwnerNode()->GetType().c_str(), in_archor_ptr->GetIdx()); | |||
| GELOGE(domi::INTERNAL_ERROR, "Add edge failed,src op:%s,dst op:%s", arg_node->GetName().c_str(), | |||
| node->GetName().c_str()); | |||
| return FAILED; | |||
| @@ -310,7 +351,12 @@ domi::Status GraphToFunctionDef::RecordArg(ge::ComputeGraphPtr graph, const vect | |||
| node_exists = true; | |||
| } | |||
| } | |||
| GE_IF_BOOL_EXEC(!node_exists, GELOGE(FAILED, "node not exists!"); return FAILED); | |||
| GE_IF_BOOL_EXEC(!node_exists, | |||
| REPORT_CALL_ERROR("E19999", "Node:%s(%s) not found in graph:%s, check invalid", | |||
| anchor->GetOwnerNode()->GetName().c_str(), | |||
| anchor->GetOwnerNode()->GetType().c_str(), | |||
| graph->GetName().c_str()); | |||
| GELOGE(FAILED, "node not exists!"); return FAILED); | |||
| arg_datetypes_.emplace_back(domi::tensorflow::DataType(dtype)); | |||
| index++; | |||
| } | |||
| @@ -422,6 +468,8 @@ domi::Status GraphToFunctionDef::DavGraphToFunctionDef(ge::ComputeGraphPtr graph | |||
| // Add regular inputs | |||
| for (auto anchor : in_anchors) { | |||
| GE_IF_BOOL_EXEC(anchor == nullptr, | |||
| REPORT_INNER_ERROR("E19999", "Nonconsecutive input edges; missing input edge for node %s", | |||
| node_def_.name().c_str()); | |||
| GELOGE(domi::INTERNAL_ERROR, "Nonconsecutive input edges; missing input edge , for node %s .", | |||
| node_def_.name().c_str()); | |||
| return domi::INTERNAL_ERROR); | |||
| @@ -413,6 +413,8 @@ Status SetTensorAttr(ge::OpDescPtr &opDesc, google::protobuf::Map<string, domi:: | |||
| data_count = ge_tensor->GetData().size() / sizeof(bool); | |||
| break; | |||
| default: | |||
| REPORT_INNER_ERROR("E19999", "datatype:%d of Attr:%s in node:%s:%s is not supported", | |||
| ge_datatype, attr.first.c_str(), opDesc->GetName().c_str(), opDesc->GetType().c_str()); | |||
| GELOGE(PARAM_INVALID, "NO SUPPORT datatype = %s", ge::TypeUtils::DataTypeToSerialString(ge_datatype).c_str()); | |||
| return PARAM_INVALID; | |||
| } | |||
| @@ -519,11 +521,20 @@ typedef Status (*PIOListHandle)(ge::GeAttrValue::LIST_INT &input_list, ge::GeAtt | |||
| Status GatherV2IOList(ge::GeAttrValue::LIST_INT &input_list, ge::GeAttrValue::LIST_INT &output_list, | |||
| ge::OpDescPtr &opDesc) { | |||
| int tparams; | |||
| GE_CHK_BOOL_EXEC((ge::AttrUtils::GetInt(opDesc, "Tparams", tparams)), return PARAM_INVALID, "Get Tparams error."); | |||
| GE_CHK_BOOL_EXEC((ge::AttrUtils::GetInt(opDesc, "Tparams", tparams)), | |||
| REPORT_CALL_ERROR("E19999", "Get Attr:Tparams from op:%s(%s) failed", | |||
| opDesc->GetName().c_str(), opDesc->GetType().c_str()); | |||
| return PARAM_INVALID, "Get Tparams error."); | |||
| int tindices; | |||
| GE_CHK_BOOL_EXEC((ge::AttrUtils::GetInt(opDesc, "Tindices", tindices)), return PARAM_INVALID, "Get Tindices error."); | |||
| GE_CHK_BOOL_EXEC((ge::AttrUtils::GetInt(opDesc, "Tindices", tindices)), | |||
| REPORT_CALL_ERROR("E19999", "Get Attr:Tindices from op:%s(%s) failed", | |||
| opDesc->GetName().c_str(), opDesc->GetType().c_str()); | |||
| return PARAM_INVALID, "Get Tindices error."); | |||
| int taxis; | |||
| GE_CHK_BOOL_EXEC((ge::AttrUtils::GetInt(opDesc, "Taxis", taxis)), return PARAM_INVALID, "Get Taxis error."); | |||
| GE_CHK_BOOL_EXEC((ge::AttrUtils::GetInt(opDesc, "Taxis", taxis)), | |||
| REPORT_CALL_ERROR("E19999", "Get Attr:Taxis from op:%s(%s) failed", | |||
| opDesc->GetName().c_str(), opDesc->GetType().c_str()); | |||
| return PARAM_INVALID, "Get Taxis error."); | |||
| // input_list - eg:{1, 3, 3} | |||
| input_list.push_back(tparams); | |||
| @@ -548,7 +559,10 @@ Status ConstIOList(ge::GeAttrValue::LIST_INT &input_list, ge::GeAttrValue::LIST_ | |||
| Status MaxMinIOList(ge::GeAttrValue::LIST_INT &input_list, ge::GeAttrValue::LIST_INT &output_list, | |||
| ge::OpDescPtr &opDesc) { | |||
| int attrT; | |||
| GE_CHK_BOOL_EXEC((ge::AttrUtils::GetInt(opDesc, "T", attrT)), return PARAM_INVALID, "Get Tparams error."); | |||
| GE_CHK_BOOL_EXEC((ge::AttrUtils::GetInt(opDesc, "T", attrT)), | |||
| REPORT_CALL_ERROR("E19999", "Get Attr:T from op:%s(%s) failed", | |||
| opDesc->GetName().c_str(), opDesc->GetType().c_str()); | |||
| return PARAM_INVALID, "Get Tparams error."); | |||
| // input_list | |||
| input_list.push_back(attrT); | |||
| @@ -564,8 +578,14 @@ Status CastIOList(ge::GeAttrValue::LIST_INT &input_list, ge::GeAttrValue::LIST_I | |||
| ge::OpDescPtr &opDesc) { | |||
| int srcT; | |||
| int dstT; | |||
| GE_CHK_BOOL_EXEC((ge::AttrUtils::GetInt(opDesc, "SrcT", srcT)), return PARAM_INVALID, "Get srcT error."); | |||
| GE_CHK_BOOL_EXEC((ge::AttrUtils::GetInt(opDesc, "DstT", dstT)), return PARAM_INVALID, "Get dstT error."); | |||
| GE_CHK_BOOL_EXEC((ge::AttrUtils::GetInt(opDesc, "SrcT", srcT)), | |||
| REPORT_CALL_ERROR("E19999", "Get Attr:SrcT from op:%s(%s) failed", | |||
| opDesc->GetName().c_str(), opDesc->GetType().c_str()); | |||
| return PARAM_INVALID, "Get srcT error."); | |||
| GE_CHK_BOOL_EXEC((ge::AttrUtils::GetInt(opDesc, "DstT", dstT)), | |||
| REPORT_CALL_ERROR("E19999", "Get Attr:DstT from op:%s(%s) failed", | |||
| opDesc->GetName().c_str(), opDesc->GetType().c_str()); | |||
| return PARAM_INVALID, "Get dstT error."); | |||
| input_list.push_back(srcT); | |||
| output_list.push_back(dstT); | |||
| @@ -574,7 +594,10 @@ Status CastIOList(ge::GeAttrValue::LIST_INT &input_list, ge::GeAttrValue::LIST_I | |||
| Status AddIOList(ge::GeAttrValue::LIST_INT &input_list, ge::GeAttrValue::LIST_INT &output_list, ge::OpDescPtr &opDesc) { | |||
| int type; | |||
| GE_CHK_BOOL_EXEC((ge::AttrUtils::GetInt(opDesc, "T", type)), return PARAM_INVALID, "Get T error."); | |||
| GE_CHK_BOOL_EXEC((ge::AttrUtils::GetInt(opDesc, "T", type)), | |||
| REPORT_CALL_ERROR("E19999", "Get Attr:T from op:%s(%s) failed", | |||
| opDesc->GetName().c_str(), opDesc->GetType().c_str()); | |||
| return PARAM_INVALID, "Get T error."); | |||
| input_list.push_back(type); | |||
| input_list.push_back(type); | |||
| @@ -587,7 +610,10 @@ Status AddIOList(ge::GeAttrValue::LIST_INT &input_list, ge::GeAttrValue::LIST_IN | |||
| Status LessIOList(ge::GeAttrValue::LIST_INT &input_list, ge::GeAttrValue::LIST_INT &output_list, | |||
| ge::OpDescPtr &opDesc) { | |||
| int dtype; | |||
| GE_CHK_BOOL_EXEC((ge::AttrUtils::GetInt(opDesc, "T", dtype)), return PARAM_INVALID, "Get dtype error."); | |||
| GE_CHK_BOOL_EXEC((ge::AttrUtils::GetInt(opDesc, "T", dtype)), | |||
| REPORT_CALL_ERROR("E19999", "Get Attr:T from op:%s(%s) failed", | |||
| opDesc->GetName().c_str(), opDesc->GetType().c_str()); | |||
| return PARAM_INVALID, "Get dtype error."); | |||
| input_list.push_back(dtype); | |||
| input_list.push_back(dtype); | |||
| @@ -598,7 +624,10 @@ Status LessIOList(ge::GeAttrValue::LIST_INT &input_list, ge::GeAttrValue::LIST_I | |||
| Status MulIOList(ge::GeAttrValue::LIST_INT &input_list, ge::GeAttrValue::LIST_INT &output_list, ge::OpDescPtr &opDesc) { | |||
| int dataType; | |||
| GE_CHK_BOOL_EXEC((ge::AttrUtils::GetInt(opDesc, ge::ATTR_NAME_T, dataType)), return PARAM_INVALID, | |||
| GE_CHK_BOOL_EXEC((ge::AttrUtils::GetInt(opDesc, ge::ATTR_NAME_T, dataType)), | |||
| REPORT_CALL_ERROR("E19999", "Get Attr:%s from op:%s(%s) failed", ge::ATTR_NAME_T.c_str(), | |||
| opDesc->GetName().c_str(), opDesc->GetType().c_str()); | |||
| return PARAM_INVALID, | |||
| "Get Tparams error."); | |||
| input_list.push_back(dataType); | |||
| @@ -612,7 +641,10 @@ Status MulIOList(ge::GeAttrValue::LIST_INT &input_list, ge::GeAttrValue::LIST_IN | |||
| Status RealDivIOList(ge::GeAttrValue::LIST_INT &input_list, ge::GeAttrValue::LIST_INT &output_list, | |||
| ge::OpDescPtr &opDesc) { | |||
| int t; | |||
| GE_CHK_BOOL_EXEC((ge::AttrUtils::GetInt(opDesc, "T", t)), return PARAM_INVALID, "Get beta error."); | |||
| GE_CHK_BOOL_EXEC((ge::AttrUtils::GetInt(opDesc, "T", t)), | |||
| REPORT_CALL_ERROR("E19999", "Get Attr:T from op:%s(%s) failed", | |||
| opDesc->GetName().c_str(), opDesc->GetType().c_str()); | |||
| return PARAM_INVALID, "Get beta error."); | |||
| input_list.push_back(t); | |||
| input_list.push_back(t); | |||
| @@ -625,7 +657,10 @@ Status RealDivIOList(ge::GeAttrValue::LIST_INT &input_list, ge::GeAttrValue::LIS | |||
| Status SelectIOList(ge::GeAttrValue::LIST_INT &input_list, ge::GeAttrValue::LIST_INT &output_list, | |||
| ge::OpDescPtr &opDesc) { | |||
| int t; | |||
| GE_CHK_BOOL_EXEC((ge::AttrUtils::GetInt(opDesc, "T", t)), return PARAM_INVALID, "Get e error."); | |||
| GE_CHK_BOOL_EXEC((ge::AttrUtils::GetInt(opDesc, "T", t)), | |||
| REPORT_CALL_ERROR("E19999", "Get Attr:T from op:%s(%s) failed", | |||
| opDesc->GetName().c_str(), opDesc->GetType().c_str()); | |||
| return PARAM_INVALID, "Get e error."); | |||
| input_list.push_back(domi::tensorflow::DataType::DT_BOOL); | |||
| input_list.push_back(t); | |||
| @@ -639,7 +674,10 @@ Status SelectIOList(ge::GeAttrValue::LIST_INT &input_list, ge::GeAttrValue::LIST | |||
| Status SqrtIOList(ge::GeAttrValue::LIST_INT &input_list, ge::GeAttrValue::LIST_INT &output_list, | |||
| ge::OpDescPtr &opDesc) { | |||
| int dataType; | |||
| GE_CHK_BOOL_EXEC((ge::AttrUtils::GetInt(opDesc, ge::ATTR_NAME_T, dataType)), return PARAM_INVALID, | |||
| GE_CHK_BOOL_EXEC((ge::AttrUtils::GetInt(opDesc, ge::ATTR_NAME_T, dataType)), | |||
| REPORT_CALL_ERROR("E19999", "Get Attr:%s from op:%s(%s) failed", ge::ATTR_NAME_T.c_str(), | |||
| opDesc->GetName().c_str(), opDesc->GetType().c_str()); | |||
| return PARAM_INVALID, | |||
| "Get Tparam error."); | |||
| input_list.push_back(dataType); | |||
| @@ -653,8 +691,14 @@ Status TruncatedNormalIOList(ge::GeAttrValue::LIST_INT &input_list, ge::GeAttrVa | |||
| ge::OpDescPtr &opDesc) { | |||
| int t; | |||
| int dtype; | |||
| GE_CHK_BOOL_EXEC((ge::AttrUtils::GetInt(opDesc, "T", t)), return PARAM_INVALID, "Get T error."); | |||
| GE_CHK_BOOL_EXEC((ge::AttrUtils::GetInt(opDesc, "dtype", dtype)), return PARAM_INVALID, "Get e error."); | |||
| GE_CHK_BOOL_EXEC((ge::AttrUtils::GetInt(opDesc, "T", t)), | |||
| REPORT_CALL_ERROR("E19999", "Get Attr:T from op:%s(%s) failed", | |||
| opDesc->GetName().c_str(), opDesc->GetType().c_str()); | |||
| return PARAM_INVALID, "Get T error."); | |||
| GE_CHK_BOOL_EXEC((ge::AttrUtils::GetInt(opDesc, "dtype", dtype)), | |||
| REPORT_CALL_ERROR("E19999", "Get Attr:dtype from op:%s(%s) failed", | |||
| opDesc->GetName().c_str(), opDesc->GetType().c_str()); | |||
| return PARAM_INVALID, "Get e error."); | |||
| input_list.push_back(t); | |||
| @@ -667,8 +711,14 @@ Status PackIOList(ge::GeAttrValue::LIST_INT &input_list, ge::GeAttrValue::LIST_I | |||
| ge::OpDescPtr &opDesc) { | |||
| int t; | |||
| int n; | |||
| GE_CHK_BOOL_EXEC((ge::AttrUtils::GetInt(opDesc, "T", t)), return PARAM_INVALID, "Get T error."); | |||
| GE_CHK_BOOL_EXEC((ge::AttrUtils::GetInt(opDesc, "N", n)), return PARAM_INVALID, "Get N error."); | |||
| GE_CHK_BOOL_EXEC((ge::AttrUtils::GetInt(opDesc, "T", t)), | |||
| REPORT_CALL_ERROR("E19999", "Get Attr:T from op:%s(%s) failed", | |||
| opDesc->GetName().c_str(), opDesc->GetType().c_str()); | |||
| return PARAM_INVALID, "Get T error."); | |||
| GE_CHK_BOOL_EXEC((ge::AttrUtils::GetInt(opDesc, "N", n)), | |||
| REPORT_CALL_ERROR("E19999", "Get Attr:N from op:%s(%s) failed", | |||
| opDesc->GetName().c_str(), opDesc->GetType().c_str()); | |||
| return PARAM_INVALID, "Get N error."); | |||
| for (int i = 0; i < n; i++) { | |||
| input_list.push_back(t); | |||
| @@ -692,8 +742,14 @@ Status ExpandDimsIOList(ge::GeAttrValue::LIST_INT &input_list, ge::GeAttrValue:: | |||
| ge::OpDescPtr &opDesc) { | |||
| int dataType; | |||
| int dimType; | |||
| GE_CHK_BOOL_EXEC((ge::AttrUtils::GetInt(opDesc, "T", dataType)), return PARAM_INVALID, "Get T error."); | |||
| GE_CHK_BOOL_EXEC((ge::AttrUtils::GetInt(opDesc, "Tdim", dimType)), return PARAM_INVALID, "Get Tdim error."); | |||
| GE_CHK_BOOL_EXEC((ge::AttrUtils::GetInt(opDesc, "T", dataType)), | |||
| REPORT_CALL_ERROR("E19999", "Get Attr:T from op:%s(%s) failed", | |||
| opDesc->GetName().c_str(), opDesc->GetType().c_str()); | |||
| return PARAM_INVALID, "Get T error."); | |||
| GE_CHK_BOOL_EXEC((ge::AttrUtils::GetInt(opDesc, "Tdim", dimType)), | |||
| REPORT_CALL_ERROR("E19999", "Get Attr:Tdim from op:%s(%s) failed", | |||
| opDesc->GetName().c_str(), opDesc->GetType().c_str()); | |||
| return PARAM_INVALID, "Get Tdim error."); | |||
| // input_list - x y data type | |||
| input_list.push_back(dataType); | |||
| input_list.push_back(dimType); | |||
| @@ -708,8 +764,14 @@ Status SqueezeIOList(ge::GeAttrValue::LIST_INT &input_list, ge::GeAttrValue::LIS | |||
| // Set - TENSORFLOW_IN_DATATYPE/TENSORFLOW_OUT_DATATYPE | |||
| int dataType; | |||
| vector<int> dimTypeList; | |||
| GE_CHK_BOOL_EXEC((ge::AttrUtils::GetInt(opDesc, "T", dataType)), return PARAM_INVALID, "Get T error."); | |||
| GE_CHK_BOOL_EXEC((ge::AttrUtils::GetListInt(opDesc, "squeeze_dims", dimTypeList)), return PARAM_INVALID, | |||
| GE_CHK_BOOL_EXEC((ge::AttrUtils::GetInt(opDesc, "T", dataType)), | |||
| REPORT_CALL_ERROR("E19999", "Get Attr:T from op:%s(%s) failed", | |||
| opDesc->GetName().c_str(), opDesc->GetType().c_str()); | |||
| return PARAM_INVALID, "Get T error."); | |||
| GE_CHK_BOOL_EXEC((ge::AttrUtils::GetListInt(opDesc, "squeeze_dims", dimTypeList)), | |||
| REPORT_CALL_ERROR("E19999", "Get Attr:squeeze_dims from op:%s(%s) failed", | |||
| opDesc->GetName().c_str(), opDesc->GetType().c_str()); | |||
| return PARAM_INVALID, | |||
| "Get squeeze_dims error."); | |||
| for (auto i : dimTypeList) { | |||
| GELOGI("squeeze_dims = %d.\n", i); | |||
| @@ -726,7 +788,10 @@ Status SqueezeIOList(ge::GeAttrValue::LIST_INT &input_list, ge::GeAttrValue::LIS | |||
| Status TopKV2IOList(ge::GeAttrValue::LIST_INT &inputList, ge::GeAttrValue::LIST_INT &outputList, | |||
| ge::OpDescPtr &opDesc) { | |||
| int t; | |||
| GE_CHK_BOOL_EXEC((ge::AttrUtils::GetInt(opDesc, "T", t)), return PARAM_INVALID, "Get T error."); | |||
| GE_CHK_BOOL_EXEC((ge::AttrUtils::GetInt(opDesc, "T", t)), | |||
| REPORT_CALL_ERROR("E19999", "Get Attr:T from op:%s(%s) failed", | |||
| opDesc->GetName().c_str(), opDesc->GetType().c_str()); | |||
| return PARAM_INVALID, "Get T error."); | |||
| // input_list - eg:{1, 3} | |||
| inputList.push_back(t); | |||
| @@ -798,8 +863,12 @@ Status CreateNodeDefBytes(ge::NodePtr n, string originalType, map<string, PIOLis | |||
| uint32_t size_type = 1; | |||
| bool type_ret = ge::TypeUtils::GetDataTypeLength(data_type, size_type); | |||
| GE_IF_BOOL_EXEC(!type_ret, GELOGE(PARAM_INVALID, "Can't GetDataTypeLength of data_type: %s", | |||
| ge::TypeUtils::DataTypeToSerialString(data_type).c_str()); | |||
| GE_IF_BOOL_EXEC(!type_ret, | |||
| REPORT_CALL_ERROR("E19999", "Can't get DataType:%s length of op:%s(%s)", | |||
| ge::TypeUtils::DataTypeToSerialString(data_type).c_str(), | |||
| n->GetName().c_str(), n->GetType().c_str()); | |||
| GELOGE(PARAM_INVALID, "Can't GetDataTypeLength of data_type: %s", | |||
| ge::TypeUtils::DataTypeToSerialString(data_type).c_str()); | |||
| return PARAM_INVALID); | |||
| // calculate size | |||
| @@ -815,7 +884,10 @@ Status CreateNodeDefBytes(ge::NodePtr n, string originalType, map<string, PIOLis | |||
| // Serial - nodedef proto | |||
| string nodefStr; | |||
| GE_IF_BOOL_EXEC(!proto.SerializeToString(&nodefStr), GELOGE(PARAM_INVALID, "Serialize nodedef to string failed."); | |||
| GE_IF_BOOL_EXEC(!proto.SerializeToString(&nodefStr), | |||
| REPORT_CALL_ERROR("E19999", "Serialize nodedef to string failed, op:%s(%s)", | |||
| n->GetName().c_str(), n->GetType().c_str()); | |||
| GELOGE(PARAM_INVALID, "Serialize nodedef to string failed."); | |||
| return PARAM_INVALID); | |||
| // Set - ATTR_NAME_FRAMEWORK_NODE_DEF | |||
| @@ -1167,7 +1239,10 @@ Status CreateOpDefBytes(ge::NodePtr n, string original_type) { | |||
| } | |||
| // set - opdef | |||
| string opdefString; | |||
| GE_IF_BOOL_EXEC(!proto.SerializeToString(&opdefString), GELOGE(PARAM_INVALID, "Serialize opdef to string failed."); | |||
| GE_IF_BOOL_EXEC(!proto.SerializeToString(&opdefString), | |||
| REPORT_CALL_ERROR("E19999", "Serialize opdef to string failed, op:%s(%s)", | |||
| n->GetName().c_str(), n->GetType().c_str()); | |||
| GELOGE(PARAM_INVALID, "Serialize opdef to string failed."); | |||
| return PARAM_INVALID); | |||
| (void)ge::AttrUtils::SetStr(opDesc, ge::ATTR_NAME_FRAMEWORK_OP_DEF, opdefString); | |||
| @@ -1197,7 +1272,9 @@ Status CreateFuncDefBytes(ge::NodePtr n, string original_type, string func_bin_p | |||
| char *buf = nullptr; | |||
| int32_t len = 0; | |||
| GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(!ge::parser::ReadBytesFromBinaryFile(file.c_str(), &buf, len), return false, | |||
| GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(!ge::parser::ReadBytesFromBinaryFile(file.c_str(), &buf, len), | |||
| REPORT_CALL_ERROR("E19999", "Read bytes from file:%s failed", file.c_str()); | |||
| return false, | |||
| "read bytes file error!"); | |||
| GELOGI("len =%d\n", len); | |||
| @@ -1408,7 +1485,9 @@ Status ParserGraphOptimizer::UpdateGraph(vector<NodePtr> &nodes) { | |||
| std::unique_ptr<FunctionDefLibrary> func_def_lib(new (std::nothrow) FunctionDefLibrary()); | |||
| GE_CHECK_NOTNULL(func_def_lib); | |||
| // convert graph to FunctionDef | |||
| GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(nodes.size() == 0, return PARAM_INVALID, "node size must greater than 0 ."); | |||
| GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(nodes.size() == 0, | |||
| REPORT_INNER_ERROR("E19999", "Param nodes size must greater than 0"); | |||
| return PARAM_INVALID, "node size must greater than 0 ."); | |||
| GE_CHK_STATUS_RET(CollectNodeFuncs(nodes, func_def_lib.get()), "Collect functionDef in nodes failed."); | |||
| GE_CHK_STATUS_RET(GraphToFunctionDef::BuildFunctionDef(sub_graph, nodes[0]->GetName(), func_def_lib.get(), | |||
| node_def.get(), input_anchors, output_anchors), | |||
| @@ -1416,10 +1495,13 @@ Status ParserGraphOptimizer::UpdateGraph(vector<NodePtr> &nodes) { | |||
| string nodefStr; | |||
| string funcdefStr; | |||
| GE_IF_BOOL_EXEC(!node_def->SerializeToString(&nodefStr), GELOGE(PARAM_INVALID, "Serialize nodedef to string failed."); | |||
| GE_IF_BOOL_EXEC(!node_def->SerializeToString(&nodefStr), | |||
| REPORT_CALL_ERROR("E19999", "Serialize nodedef to string failed"); | |||
| GELOGE(PARAM_INVALID, "Serialize nodedef to string failed."); | |||
| return PARAM_INVALID); | |||
| GE_IF_BOOL_EXEC(!func_def_lib->SerializeToString(&funcdefStr), | |||
| REPORT_CALL_ERROR("E19999", "Serialize func_def to string failed, "); | |||
| GELOGE(PARAM_INVALID, "Serialize func_def to string failed."); | |||
| return PARAM_INVALID); | |||
| @@ -1521,6 +1603,9 @@ Status ParserGraphOptimizer::LinkInnerAnchor(unordered_map<string, ge::NodePtr> | |||
| GE_IF_BOOL_EXEC(ge::GraphUtils::AddEdge(src->GetOutDataAnchor(peer_out_anchor->GetIdx()), | |||
| dst->GetInDataAnchor(in_anchor->GetIdx())) != GRAPH_SUCCESS, | |||
| REPORT_CALL_ERROR("E19999", "Add edge between op:%s(%s)(index:%d) and op:%s(%s)(index:%d) failed", | |||
| src->GetName().c_str(), src->GetType().c_str(), peer_out_anchor->GetIdx(), | |||
| dst->GetName().c_str(), dst->GetType().c_str(), in_anchor->GetIdx()); | |||
| GELOGE(FAILED, | |||
| "LinkInnerAnchor Link data anchor failed, src node: %s, " | |||
| "dst node: %s.", | |||
| @@ -1536,6 +1621,9 @@ Status ParserGraphOptimizer::LinkInnerAnchor(unordered_map<string, ge::NodePtr> | |||
| NodePtr src_ctrl = node_map[peer_out_ctl_anchor->GetOwnerNode()->GetName()]; | |||
| GE_IF_BOOL_EXEC( | |||
| ge::GraphUtils::AddEdge(src_ctrl->GetOutControlAnchor(), dst->GetInControlAnchor()) != GRAPH_SUCCESS, | |||
| REPORT_CALL_ERROR("E19999", "Add control edge between op:%s(%s) and op:%s(%s) failed", | |||
| src_ctrl->GetName().c_str(), src_ctrl->GetType().c_str(), | |||
| dst->GetName().c_str(), dst->GetType().c_str()); | |||
| GELOGE(FAILED, | |||
| "LinkInnerAnchor Link control anchor failed, src node: " | |||
| "%s, dst node: %s.", | |||
| @@ -1564,6 +1652,8 @@ Status ParserGraphOptimizer::RebuildOutputAnchors(vector<ge::OutDataAnchorPtr> & | |||
| auto iter = GE_TENSORFLOW_DATA_TYPE_MAP.find((int32_t)data_type); | |||
| GE_IF_BOOL_EXEC( | |||
| iter == GE_TENSORFLOW_DATA_TYPE_MAP.end(), | |||
| REPORT_INNER_ERROR("E19999", "datatype:%d of output:%d in node:%s:%s is not supported", | |||
| data_type, out_anchor->GetIdx(), src_node->GetName().c_str(), src_node->GetName().c_str()); | |||
| GELOGE(PARAM_INVALID, "data_type %s not supported", ge::TypeUtils::DataTypeToSerialString(data_type).c_str()); | |||
| return PARAM_INVALID); | |||
| @@ -1588,12 +1678,18 @@ Status ParserGraphOptimizer::RebuildInputAnchors(vector<ge::InDataAnchorPtr> &in | |||
| auto tensorDescPtr = dst_node->GetOpDesc()->GetInputDescPtr(in_anchor->GetIdx()); | |||
| GE_CHECK_NOTNULL_EXEC(tensorDescPtr, return domi::FAILED); | |||
| GE_CHK_BOOL_TRUE_EXEC_WITH_LOG((fusion_op_desc->AddInputDesc(*tensorDescPtr)) != GRAPH_SUCCESS, return FAILED, | |||
| GE_CHK_BOOL_TRUE_EXEC_WITH_LOG((fusion_op_desc->AddInputDesc(*tensorDescPtr)) != GRAPH_SUCCESS, | |||
| REPORT_CALL_ERROR("E19999", "Add input desc to op:%s(%s) failed", | |||
| fusion_op_desc->GetName().c_str(), | |||
| fusion_op_desc->GetType().c_str()); | |||
| return FAILED, | |||
| "Add fusion_op_desc AddInputDesc failed"); | |||
| ge::DataType data_type = tensorDescPtr->GetDataType(); | |||
| auto iter = GE_TENSORFLOW_DATA_TYPE_MAP.find((int32_t)data_type); | |||
| GE_IF_BOOL_EXEC( | |||
| iter == GE_TENSORFLOW_DATA_TYPE_MAP.end(), | |||
| REPORT_INNER_ERROR("E19999", "datatype:%d of input:%d in node:%s:%s is not supported", | |||
| data_type, in_anchor->GetIdx(), dst_node->GetName().c_str(), dst_node->GetName().c_str()); | |||
| GELOGE(PARAM_INVALID, "data_type %s not supported", ge::TypeUtils::DataTypeToSerialString(data_type).c_str()); | |||
| return PARAM_INVALID); | |||
| @@ -1658,12 +1754,18 @@ Status ParserGraphOptimizer::Insert4DTo5DTransOp(OutDataAnchorPtr src_anchor, In | |||
| if (src_out_data_type != dst_in_data_type) { | |||
| OpDescPtr cast_opdesc = CreateCastOp(src_out_data_type, dst_in_data_type, ge::FORMAT_NCHW); | |||
| cast_node = graph_->AddNode(cast_opdesc); | |||
| GE_CHK_BOOL_EXEC(cast_node != nullptr, return INTERNAL_ERROR, "graph add cast node fail."); | |||
| GE_CHK_BOOL_EXEC(cast_node != nullptr, | |||
| REPORT_CALL_ERROR("E19999", "Add Cast node to graph:%s failed", | |||
| graph_->GetName().c_str()); | |||
| return INTERNAL_ERROR, "graph add cast node fail."); | |||
| } | |||
| OpDescPtr trans_data_opdesc = CreateTransDataOp(FORMAT_NCHW); | |||
| NodePtr trans_data_node = graph_->AddNode(trans_data_opdesc); | |||
| GE_CHK_BOOL_EXEC(trans_data_node != nullptr, return INTERNAL_ERROR, "graph add TransData node node fail."); | |||
| GE_CHK_BOOL_EXEC(trans_data_node != nullptr, | |||
| REPORT_CALL_ERROR("E19999", "Add Transdata node to graph:%s failed", | |||
| graph_->GetName().c_str()); | |||
| return INTERNAL_ERROR, "graph add TransData node node fail."); | |||
| GE_CHK_STATUS_RET(NewNodeAddEdges(src_anchor, dst_anchor, nullptr, cast_node, trans_data_node), | |||
| "NewNodeAddEdges ret fail."); | |||
| @@ -1676,8 +1778,18 @@ Status ParserGraphOptimizer::Insert4DTo5DTransOp(OutDataAnchorPtr src_anchor, In | |||
| GE_CHECK_NOTNULL(transNode); | |||
| GELOGI("Create 4D To 5D fp32 node susscess!"); | |||
| GE_IF_BOOL_EXEC(GraphUtils::AddEdge(src_anchor, transNode->GetInDataAnchor(0)), return INTERNAL_ERROR); | |||
| GE_IF_BOOL_EXEC(GraphUtils::AddEdge(transNode->GetOutDataAnchor(0), dst_anchor), return INTERNAL_ERROR); | |||
| GE_IF_BOOL_EXEC(GraphUtils::AddEdge(src_anchor, transNode->GetInDataAnchor(0)), | |||
| REPORT_CALL_ERROR("E19999", "Add edge between op:%s(%s)(index:%d) and op:%s(%s)(index:0) failed", | |||
| src_anchor->GetOwnerNode()->GetName().c_str(), | |||
| src_anchor->GetOwnerNode()->GetType().c_str(), src_anchor->GetIdx(), | |||
| transNode->GetName().c_str(), transNode->GetType().c_str()); | |||
| return INTERNAL_ERROR); | |||
| GE_IF_BOOL_EXEC(GraphUtils::AddEdge(transNode->GetOutDataAnchor(0), dst_anchor), | |||
| REPORT_CALL_ERROR("E19999", "Add edge between op:%s(%s)(index:0) and op:%s(%s)(index:%d) failed", | |||
| transNode->GetName().c_str(), transNode->GetType().c_str(), | |||
| dst_anchor->GetOwnerNode()->GetName().c_str(), | |||
| dst_anchor->GetOwnerNode()->GetType().c_str(), dst_anchor->GetIdx()); | |||
| return INTERNAL_ERROR); | |||
| GELOGI("Create 4D To 5D susscess!"); | |||
| return SUCCESS; | |||
| @@ -1701,14 +1813,39 @@ Status ParserGraphOptimizer::InsertFZ2HWCK(OutDataAnchorPtr src_anchor, InDataAn | |||
| OpDescPtr translatetoHWCK = CreateTranslateOp(srcOutFormat, ge::DT_FLOAT16, dstInFormat, dstInDatatype); | |||
| NodePtr transHWCKNode = graph_->AddNode(translatetoHWCK); GELOGI("Create FZ 16 to HWCK fp32 node susscess!"); | |||
| GE_CHECK_NOTNULL(transHWCKNode); if (transHalfNode) { | |||
| GE_IF_BOOL_EXEC(GraphUtils::AddEdge(src_anchor, transHalfNode->GetInDataAnchor(0)), return INTERNAL_ERROR); | |||
| GE_IF_BOOL_EXEC(GraphUtils::AddEdge(src_anchor, transHalfNode->GetInDataAnchor(0)), | |||
| REPORT_CALL_ERROR( | |||
| "E19999", "Add edge between op:%s(%s)(index:%d) and op:%s(%s)(index:0) failed", | |||
| src_anchor->GetOwnerNode()->GetName().c_str(), | |||
| src_anchor->GetOwnerNode()->GetType().c_str(), src_anchor->GetIdx(), | |||
| transHalfNode->GetName().c_str(), transHalfNode->GetType().c_str()); | |||
| return INTERNAL_ERROR); | |||
| GE_IF_BOOL_EXEC(GraphUtils::AddEdge(transHalfNode->GetOutDataAnchor(0), transHWCKNode->GetInDataAnchor(0)), | |||
| REPORT_CALL_ERROR("E19999", "Add edge between op:%s(%s)(index:0) and op:%s(%s)(index:0) failed", | |||
| transHalfNode->GetName().c_str(), transHalfNode->GetType().c_str(), | |||
| transHWCKNode->GetName().c_str(), transHWCKNode->GetType().c_str()); | |||
| return INTERNAL_ERROR); | |||
| GE_IF_BOOL_EXEC(GraphUtils::AddEdge(transHWCKNode->GetOutDataAnchor(0), dst_anchor) != SUCCESS, | |||
| REPORT_CALL_ERROR( | |||
| "E19999", "Add edge between op:%s(%s)(index:0) and op:%s(%s)(index:%d) failed", | |||
| transHWCKNode->GetName().c_str(), transHWCKNode->GetType().c_str(), | |||
| dst_anchor->GetOwnerNode()->GetName().c_str(), | |||
| dst_anchor->GetOwnerNode()->GetType().c_str(), dst_anchor->GetIdx()); | |||
| return INTERNAL_ERROR); | |||
| } else { | |||
| GE_IF_BOOL_EXEC(GraphUtils::AddEdge(src_anchor, transHWCKNode->GetInDataAnchor(0)), return INTERNAL_ERROR); | |||
| GE_IF_BOOL_EXEC(GraphUtils::AddEdge(src_anchor, transHWCKNode->GetInDataAnchor(0)), | |||
| REPORT_CALL_ERROR( | |||
| "E19999", "Add edge between op:%s(%s)(index:%d) and op:%s(%s)(index:0) failed", | |||
| src_anchor->GetOwnerNode()->GetName().c_str(), | |||
| src_anchor->GetOwnerNode()->GetType().c_str(), src_anchor->GetIdx(), | |||
| transHWCKNode->GetName().c_str(), transHWCKNode->GetType().c_str()); | |||
| return INTERNAL_ERROR); | |||
| GE_IF_BOOL_EXEC(GraphUtils::AddEdge(transHWCKNode->GetOutDataAnchor(0), dst_anchor) != SUCCESS, | |||
| REPORT_CALL_ERROR( | |||
| "E19999", "Add edge between op:%s(%s)(index:0) and op:%s(%s)(index:%d) failed", | |||
| transHWCKNode->GetName().c_str(), transHWCKNode->GetType().c_str(), | |||
| dst_anchor->GetOwnerNode()->GetName().c_str(), | |||
| dst_anchor->GetOwnerNode()->GetType().c_str(), dst_anchor->GetIdx()); | |||
| return INTERNAL_ERROR); | |||
| } GELOGI("Create InsertFZ2HWCK success!");) | |||
| return SUCCESS; | |||
| @@ -1731,14 +1868,40 @@ Status ParserGraphOptimizer::InsertVar5DTo4D(ge::OutDataAnchorPtr src_anchor, ge | |||
| GE_CHECK_NOTNULL(trans4DNode); | |||
| if (cast_node) { | |||
| GE_IF_BOOL_EXEC(GraphUtils::AddEdge(src_anchor, cast_node->GetInDataAnchor(0)), return INTERNAL_ERROR); | |||
| GE_IF_BOOL_EXEC(GraphUtils::AddEdge(src_anchor, cast_node->GetInDataAnchor(0)), | |||
| REPORT_CALL_ERROR( | |||
| "E19999", "Add edge between op:%s(%s)(index:%d) and op:%s(%s)(index:0) failed", | |||
| src_anchor->GetOwnerNode()->GetName().c_str(), | |||
| src_anchor->GetOwnerNode()->GetType().c_str(), src_anchor->GetIdx(), | |||
| cast_node->GetName().c_str(), cast_node->GetType().c_str()); | |||
| return INTERNAL_ERROR); | |||
| GE_IF_BOOL_EXEC(GraphUtils::AddEdge(cast_node->GetOutDataAnchor(0), trans4DNode->GetInDataAnchor(0)), | |||
| REPORT_CALL_ERROR( | |||
| "E19999", "Add edge between op:%s(%s)(index:0) and op:%s(%s)(index:0) failed", | |||
| cast_node->GetName().c_str(), cast_node->GetType().c_str(), | |||
| trans4DNode->GetName().c_str(), trans4DNode->GetType().c_str()); | |||
| return INTERNAL_ERROR); | |||
| GE_IF_BOOL_EXEC(GraphUtils::AddEdge(trans4DNode->GetOutDataAnchor(0), dst_anchor) != SUCCESS, | |||
| REPORT_CALL_ERROR( | |||
| "E19999", "Add edge between op:%s(%s)(index:0) and op:%s(%s)(index:%d) failed", | |||
| trans4DNode->GetName().c_str(), trans4DNode->GetType().c_str(), | |||
| dst_anchor->GetOwnerNode()->GetName().c_str(), | |||
| dst_anchor->GetOwnerNode()->GetType().c_str(), dst_anchor->GetIdx()); | |||
| return INTERNAL_ERROR); | |||
| } else { | |||
| GE_IF_BOOL_EXEC(GraphUtils::AddEdge(src_anchor, trans4DNode->GetInDataAnchor(0)), return INTERNAL_ERROR); | |||
| GE_IF_BOOL_EXEC(GraphUtils::AddEdge(src_anchor, trans4DNode->GetInDataAnchor(0)), | |||
| REPORT_CALL_ERROR( | |||
| "E19999", "Add edge between op:%s(%s)(index:%d) and op:%s(%s)(index:0) failed", | |||
| src_anchor->GetOwnerNode()->GetName().c_str(), | |||
| src_anchor->GetOwnerNode()->GetType().c_str(), src_anchor->GetIdx(), | |||
| trans4DNode->GetName().c_str(), trans4DNode->GetType().c_str()); | |||
| return INTERNAL_ERROR); | |||
| GE_IF_BOOL_EXEC(GraphUtils::AddEdge(trans4DNode->GetOutDataAnchor(0), dst_anchor) != SUCCESS, | |||
| REPORT_CALL_ERROR( | |||
| "E19999", "Add edge between op:%s(%s)(index:0) and op:%s(%s)(index:%d) failed", | |||
| trans4DNode->GetName().c_str(), trans4DNode->GetType().c_str(), | |||
| dst_anchor->GetOwnerNode()->GetName().c_str(), | |||
| dst_anchor->GetOwnerNode()->GetType().c_str(), dst_anchor->GetIdx()); | |||
| return INTERNAL_ERROR); | |||
| } GELOGI("Create 5D To 4D susscess!");) | |||
| return SUCCESS; | |||
| @@ -1764,15 +1927,40 @@ Status ParserGraphOptimizer::InsertHWCK2FZ(OutDataAnchorPtr src_anchor, InDataAn | |||
| } | |||
| if (translateHalftoFp32Node) { | |||
| GE_IF_BOOL_EXEC(GraphUtils::AddEdge(src_anchor, transHWCK2FZNode->GetInDataAnchor(0)), return INTERNAL_ERROR); | |||
| GE_IF_BOOL_EXEC(GraphUtils::AddEdge(src_anchor, transHWCK2FZNode->GetInDataAnchor(0)), | |||
| REPORT_CALL_ERROR( | |||
| "E19999", "Add edge between op:%s(%s)(index:%d) and op:%s(%s)(index:0) failed", | |||
| src_anchor->GetOwnerNode()->GetName().c_str(), | |||
| src_anchor->GetOwnerNode()->GetType().c_str(), src_anchor->GetIdx(), | |||
| transHWCK2FZNode->GetName().c_str(), transHWCK2FZNode->GetType().c_str()); | |||
| return INTERNAL_ERROR); | |||
| GE_IF_BOOL_EXEC( | |||
| GraphUtils::AddEdge(transHWCK2FZNode->GetOutDataAnchor(0), translateHalftoFp32Node->GetInDataAnchor(0)), | |||
| REPORT_CALL_ERROR("E19999", "Add edge between op:%s(%s)(index:0) and op:%s(%s)(index:0) failed", | |||
| transHWCK2FZNode->GetName().c_str(), transHWCK2FZNode->GetType().c_str(), | |||
| translateHalftoFp32Node->GetName().c_str(), translateHalftoFp32Node->GetType().c_str()); | |||
| return INTERNAL_ERROR); | |||
| GE_IF_BOOL_EXEC(GraphUtils::AddEdge(translateHalftoFp32Node->GetOutDataAnchor(0), dst_anchor) != SUCCESS, | |||
| REPORT_CALL_ERROR( | |||
| "E19999", "Add edge between op:%s(%s)(index:0) and op:%s(%s)(index:%d) failed", | |||
| translateHalftoFp32Node->GetName().c_str(), translateHalftoFp32Node->GetType().c_str(), | |||
| dst_anchor->GetOwnerNode()->GetName().c_str(), | |||
| dst_anchor->GetOwnerNode()->GetType().c_str(), dst_anchor->GetIdx()); | |||
| return INTERNAL_ERROR); | |||
| } else { | |||
| GE_IF_BOOL_EXEC(GraphUtils::AddEdge(src_anchor, transHWCK2FZNode->GetInDataAnchor(0)), return INTERNAL_ERROR); | |||
| GE_IF_BOOL_EXEC(GraphUtils::AddEdge(src_anchor, transHWCK2FZNode->GetInDataAnchor(0)), | |||
| REPORT_CALL_ERROR( | |||
| "E19999", "Add edge between op:%s(%s)(index:%d) and op:%s(%s)(index:0) failed", | |||
| src_anchor->GetOwnerNode()->GetName().c_str(), | |||
| src_anchor->GetOwnerNode()->GetType().c_str(), src_anchor->GetIdx(), | |||
| transHWCK2FZNode->GetName().c_str(), transHWCK2FZNode->GetType().c_str()); | |||
| return INTERNAL_ERROR); | |||
| GE_IF_BOOL_EXEC(GraphUtils::AddEdge(transHWCK2FZNode->GetOutDataAnchor(0), dst_anchor) != SUCCESS, | |||
| REPORT_CALL_ERROR( | |||
| "E19999", "Add edge between op:%s(%s)(index:0) and op:%s(%s)(index:%d) failed", | |||
| transHWCK2FZNode->GetName().c_str(), transHWCK2FZNode->GetType().c_str(), | |||
| dst_anchor->GetOwnerNode()->GetName().c_str(), | |||
| dst_anchor->GetOwnerNode()->GetType().c_str(), dst_anchor->GetIdx()); | |||
| return INTERNAL_ERROR); | |||
| } GELOGI("Create InsertHWCK2FZ success!");) | |||
| return SUCCESS; | |||
| @@ -1787,18 +1975,27 @@ Status ParserGraphOptimizer::Insert5DTo4DTransOp(OutDataAnchorPtr src_anchor, In | |||
| OpDescPtr trans_data_opdesc = CreateTransDataOp(FORMAT_NC1HWC0); | |||
| NodePtr trans_data_node = graph_->AddNode(trans_data_opdesc); | |||
| GE_CHK_BOOL_EXEC(trans_data_node != nullptr, return INTERNAL_ERROR, "graph add TransData node node fail."); | |||
| GE_CHK_BOOL_EXEC(trans_data_node != nullptr, | |||
| REPORT_CALL_ERROR("E19999", "Add Transdata node to graph:%s failed", | |||
| graph_->GetName().c_str()); | |||
| return INTERNAL_ERROR, "graph add TransData node node fail."); | |||
| if (src_out_data_type != dst_in_data_type) { | |||
| OpDescPtr cast_opdesc = CreateCastOp(src_out_data_type, dst_in_data_type, ge::FORMAT_NCHW); | |||
| cast_node = graph_->AddNode(cast_opdesc); | |||
| GE_CHK_BOOL_EXEC(cast_node != nullptr, return INTERNAL_ERROR, "graph add cast node fail."); | |||
| GE_CHK_BOOL_EXEC(cast_node != nullptr, | |||
| REPORT_CALL_ERROR("E19999", "Add Cast node to graph:%s failed", | |||
| graph_->GetName().c_str()); | |||
| return INTERNAL_ERROR, "graph add cast node fail."); | |||
| } | |||
| if (dst_in_format == FORMAT_NHWC) { | |||
| OpDescPtr permute_opdec = CreatePermuteOp(FORMAT_NCHW, dst_in_format); | |||
| permute_node = graph_->AddNode(permute_opdec); | |||
| GE_CHK_BOOL_EXEC(permute_node != nullptr, return INTERNAL_ERROR, "graph add permute node fail."); | |||
| GE_CHK_BOOL_EXEC(permute_node != nullptr, | |||
| REPORT_CALL_ERROR("E19999", "Add Permute node to graph:%s failed", | |||
| graph_->GetName().c_str()); | |||
| return INTERNAL_ERROR, "graph add permute node fail."); | |||
| } | |||
| GE_CHK_STATUS_RET(NewNodeAddEdges(src_anchor, dst_anchor, trans_data_node, cast_node, permute_node), | |||
| @@ -1818,60 +2015,136 @@ Status ParserGraphOptimizer::NewNodeAddEdges(OutDataAnchorPtr src_anchor, InData | |||
| if (first != nullptr) { | |||
| Status status = GraphUtils::AddEdge(src_anchor, first->GetInDataAnchor(0)); | |||
| GE_CHK_BOOL_EXEC(status == SUCCESS, return INTERNAL_ERROR, "graph add edge fail, src index:%d, dst index:%d.", | |||
| GE_CHK_BOOL_EXEC(status == SUCCESS, | |||
| REPORT_CALL_ERROR( | |||
| "E19999", "Add edge between op:%s(%s)(index:%d) and op:%s(%s)(index:0) failed", | |||
| src_anchor->GetOwnerNode()->GetName().c_str(), | |||
| src_anchor->GetOwnerNode()->GetType().c_str(), src_anchor->GetIdx(), | |||
| first->GetName().c_str(), first->GetType().c_str()); | |||
| return INTERNAL_ERROR, "graph add edge fail, src index:%d, dst index:%d.", | |||
| src_anchor->GetIdx(), 0); | |||
| if (second != nullptr) { | |||
| status = GraphUtils::AddEdge(first->GetOutDataAnchor(0), second->GetInDataAnchor(0)); | |||
| GE_CHK_BOOL_EXEC(status == SUCCESS, return INTERNAL_ERROR, "graph add edge fail, src index:%d, dst index:%d.", 0, | |||
| 0); | |||
| GE_CHK_BOOL_EXEC(status == SUCCESS, | |||
| REPORT_CALL_ERROR( | |||
| "E19999", "Add edge between op:%s(%s)(index:0) and op:%s(%s)(index:0) failed", | |||
| first->GetName().c_str(), first->GetType().c_str(), | |||
| second->GetName().c_str(), second->GetType().c_str()); | |||
| return INTERNAL_ERROR, "graph add edge fail, src index:%d, dst index:%d.", 0, 0); | |||
| if (third != nullptr) { | |||
| status = GraphUtils::AddEdge(second->GetOutDataAnchor(0), third->GetInDataAnchor(0)); | |||
| GE_CHK_BOOL_EXEC(status == SUCCESS, return INTERNAL_ERROR, "graph add edge fail, src index:%d, dst index:%d.", | |||
| 0, 0); | |||
| GE_CHK_BOOL_EXEC(status == SUCCESS, | |||
| REPORT_CALL_ERROR( | |||
| "E19999", "Add edge between op:%s(%s)(index:0) and op:%s(%s)(index:0) failed", | |||
| second->GetName().c_str(), second->GetType().c_str(), | |||
| third->GetName().c_str(), third->GetType().c_str()); | |||
| return INTERNAL_ERROR, "graph add edge fail, src index:%d, dst index:%d.", 0, 0); | |||
| status = GraphUtils::AddEdge(third->GetOutDataAnchor(0), dst_anchor); | |||
| GE_CHK_BOOL_EXEC(status == SUCCESS, return INTERNAL_ERROR, "graph add edge fail, src index:%d, dst index:%d.", | |||
| GE_CHK_BOOL_EXEC(status == SUCCESS, | |||
| REPORT_CALL_ERROR( | |||
| "E19999", "Add edge between op:%s(%s)(index:0) and op:%s(%s)(index:%d) failed", | |||
| third->GetName().c_str(), third->GetType().c_str(), | |||
| dst_anchor->GetOwnerNode()->GetName().c_str(), | |||
| dst_anchor->GetOwnerNode()->GetType().c_str(), dst_anchor->GetIdx()); | |||
| return INTERNAL_ERROR, "graph add edge fail, src index:%d, dst index:%d.", | |||
| 0, dst_anchor->GetIdx()); | |||
| } else { | |||
| status = GraphUtils::AddEdge(second->GetOutDataAnchor(0), dst_anchor); | |||
| GE_CHK_BOOL_EXEC(status == SUCCESS, return INTERNAL_ERROR, "graph add edge fail, src index:%d, dst index:%d.", | |||
| GE_CHK_BOOL_EXEC(status == SUCCESS, | |||
| REPORT_CALL_ERROR( | |||
| "E19999", "Add edge between op:%s(%s)(index:0) and op:%s(%s)(index:%d) failed", | |||
| second->GetName().c_str(), second->GetType().c_str(), | |||
| dst_anchor->GetOwnerNode()->GetName().c_str(), | |||
| dst_anchor->GetOwnerNode()->GetType().c_str(), dst_anchor->GetIdx()); | |||
| return INTERNAL_ERROR, "graph add edge fail, src index:%d, dst index:%d.", | |||
| 0, dst_anchor->GetIdx()); | |||
| } | |||
| } else { | |||
| if (third != nullptr) { | |||
| status = GraphUtils::AddEdge(first->GetOutDataAnchor(0), third->GetInDataAnchor(0)); | |||
| GE_CHK_BOOL_EXEC(status == SUCCESS, return INTERNAL_ERROR, "graph add edge fail, src index:%d, dst index:%d.", | |||
| 0, 0); | |||
| GE_CHK_BOOL_EXEC(status == SUCCESS, | |||
| REPORT_CALL_ERROR( | |||
| "E19999", "Add edge between op:%s(%s)(index:0) and op:%s(%s)(index:0) failed", | |||
| first->GetName().c_str(), first->GetType().c_str(), | |||
| third->GetName().c_str(), third->GetType().c_str()); | |||
| return INTERNAL_ERROR, "graph add edge fail, src index:%d, dst index:%d.", 0, 0); | |||
| status = GraphUtils::AddEdge(third->GetOutDataAnchor(0), dst_anchor); | |||
| GE_CHK_BOOL_EXEC(status == SUCCESS, return INTERNAL_ERROR, "graph add edge fail, src index:%d, dst index:%d.", | |||
| GE_CHK_BOOL_EXEC(status == SUCCESS, | |||
| REPORT_CALL_ERROR( | |||
| "E19999", "Add edge between op:%s(%s)(index:0) and op:%s(%s)(index:%d) failed", | |||
| third->GetName().c_str(), third->GetType().c_str(), | |||
| dst_anchor->GetOwnerNode()->GetName().c_str(), | |||
| dst_anchor->GetOwnerNode()->GetType().c_str(), dst_anchor->GetIdx()); | |||
| return INTERNAL_ERROR, "graph add edge fail, src index:%d, dst index:%d.", | |||
| 0, dst_anchor->GetIdx()); | |||
| } else { | |||
| status = GraphUtils::AddEdge(first->GetOutDataAnchor(0), dst_anchor); | |||
| GE_CHK_BOOL_EXEC(status == SUCCESS, return INTERNAL_ERROR, "graph add edge fail, src index:%d, dst index:%d.", | |||
| GE_CHK_BOOL_EXEC(status == SUCCESS, | |||
| REPORT_CALL_ERROR( | |||
| "E19999", "Add edge between op:%s(%s)(index:0) and op:%s(%s)(index:%d) failed", | |||
| first->GetName().c_str(), first->GetType().c_str(), | |||
| dst_anchor->GetOwnerNode()->GetName().c_str(), | |||
| dst_anchor->GetOwnerNode()->GetType().c_str(), dst_anchor->GetIdx()); | |||
| return INTERNAL_ERROR, "graph add edge fail, src index:%d, dst index:%d.", | |||
| 0, dst_anchor->GetIdx()); | |||
| } | |||
| } | |||
| } else { | |||
| if (second != nullptr) { | |||
| Status status = GraphUtils::AddEdge(src_anchor, second->GetInDataAnchor(0)); | |||
| GE_CHK_BOOL_EXEC(status == SUCCESS, return INTERNAL_ERROR, | |||
| GE_CHK_BOOL_EXEC(status == SUCCESS, | |||
| REPORT_CALL_ERROR( | |||
| "E19999", "Add edge between op:%s(%s)(index:%d) and op:%s(%s)(index:0) failed", | |||
| src_anchor->GetOwnerNode()->GetName().c_str(), | |||
| src_anchor->GetOwnerNode()->GetType().c_str(), src_anchor->GetIdx(), | |||
| second->GetName().c_str(), second->GetType().c_str()); | |||
| return INTERNAL_ERROR, | |||
| "graph add src to cast edge fail, src index:%d, dst index:%d.", src_anchor->GetIdx(), 0); | |||
| GE_IF_BOOL_EXEC( | |||
| third != nullptr, status = GraphUtils::AddEdge(second->GetOutDataAnchor(0), third->GetInDataAnchor(0)); | |||
| GE_CHK_BOOL_EXEC(status == SUCCESS, return INTERNAL_ERROR, "graph add edge fail, src index:%d, dst index:%d.", | |||
| 0, 0); | |||
| GE_CHK_BOOL_EXEC(status == SUCCESS, | |||
| REPORT_CALL_ERROR( | |||
| "E19999", "Add edge between op:%s(%s)(index:0) and op:%s(%s)(index:0) failed", | |||
| second->GetName().c_str(), second->GetType().c_str(), | |||
| third->GetName().c_str(), third->GetType().c_str()); | |||
| return INTERNAL_ERROR, "graph add edge fail, src index:%d, dst index:%d.", 0, 0); | |||
| status = GraphUtils::AddEdge(third->GetOutDataAnchor(0), dst_anchor); | |||
| GE_CHK_BOOL_EXEC(status == SUCCESS, return INTERNAL_ERROR, "graph add edge fail, src index:%d, dst index:%d.", | |||
| GE_CHK_BOOL_EXEC(status == SUCCESS, | |||
| REPORT_CALL_ERROR( | |||
| "E19999", "Add edge between op:%s(%s)(index:0) and op:%s(%s)(index:%d) failed", | |||
| third->GetName().c_str(), third->GetType().c_str(), | |||
| dst_anchor->GetOwnerNode()->GetName().c_str(), | |||
| dst_anchor->GetOwnerNode()->GetType().c_str(), dst_anchor->GetIdx()); | |||
| return INTERNAL_ERROR, "graph add edge fail, src index:%d, dst index:%d.", | |||
| 0, dst_anchor->GetIdx());); | |||
| GE_IF_BOOL_EXEC(third == nullptr, status = GraphUtils::AddEdge(second->GetOutDataAnchor(0), dst_anchor); | |||
| GE_CHK_BOOL_EXEC(status == SUCCESS, return INTERNAL_ERROR, | |||
| "graph add edge fail, src index:%d, dst index:%d.", 0, 0);); | |||
| GE_CHK_BOOL_EXEC( | |||
| status == SUCCESS, | |||
| REPORT_CALL_ERROR( | |||
| "E19999", "Add edge between op:%s(%s)(index:0) and op:%s(%s)(index:%d) failed", | |||
| second->GetName().c_str(), second->GetType().c_str(), | |||
| dst_anchor->GetOwnerNode()->GetName().c_str(), | |||
| dst_anchor->GetOwnerNode()->GetType().c_str(), dst_anchor->GetIdx()); | |||
| return INTERNAL_ERROR, | |||
| "graph add edge fail, src index:%d, dst index:%d.", 0, 0);); | |||
| } else { | |||
| if (third != nullptr) { | |||
| Status status = GraphUtils::AddEdge(src_anchor, third->GetInDataAnchor(0)); | |||
| GE_CHK_BOOL_EXEC(status == SUCCESS, return INTERNAL_ERROR, "graph add edge fail, src index:%d, dst index:%d.", | |||
| 0, 0); | |||
| GE_CHK_BOOL_EXEC(status == SUCCESS, | |||
| REPORT_CALL_ERROR( | |||
| "E19999", "Add edge between op:%s(%s)(index:%d) and op:%s(%s)(index:0) failed", | |||
| src_anchor->GetOwnerNode()->GetName().c_str(), | |||
| src_anchor->GetOwnerNode()->GetType().c_str(), src_anchor->GetIdx(), | |||
| third->GetName().c_str(), third->GetType().c_str()); | |||
| return INTERNAL_ERROR, "graph add edge fail, src index:%d, dst index:%d.", 0, 0); | |||
| status = GraphUtils::AddEdge(third->GetOutDataAnchor(0), dst_anchor); | |||
| GE_CHK_BOOL_EXEC(status == SUCCESS, return INTERNAL_ERROR, "graph add edge fail, src index:%d, dst index:%d.", | |||
| GE_CHK_BOOL_EXEC(status == SUCCESS, | |||
| REPORT_CALL_ERROR( | |||
| "E19999", "Add edge between op:%s(%s)(index:0) and op:%s(%s)(index:%d) failed", | |||
| third->GetName().c_str(), third->GetType().c_str(), | |||
| dst_anchor->GetOwnerNode()->GetName().c_str(), | |||
| dst_anchor->GetOwnerNode()->GetType().c_str(), dst_anchor->GetIdx()); | |||
| return INTERNAL_ERROR, "graph add edge fail, src index:%d, dst index:%d.", | |||
| 0, dst_anchor->GetIdx()); | |||
| } | |||
| } | |||
| @@ -1902,26 +2175,49 @@ OpDescPtr ParserGraphOptimizer::CreateTranslateOp(enum ge::Format inFormat, enum | |||
| ge::TypeUtils::DataTypeToSerialString(inDatatype).c_str(), ge::TypeUtils::FormatToSerialString(outFormat).c_str(), | |||
| ge::TypeUtils::DataTypeToSerialString(outDatatype).c_str()); | |||
| GE_CHK_BOOL_EXEC(AttrUtils::SetInt(op_def, ge::ATTR_NAME_INPUT_FORMAT, inFormat), return nullptr, | |||
| GE_CHK_BOOL_EXEC(AttrUtils::SetInt(op_def, ge::ATTR_NAME_INPUT_FORMAT, inFormat), | |||
| REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", ATTR_NAME_INPUT_FORMAT.c_str(), | |||
| op_def->GetName().c_str(), op_def->GetType().c_str()); | |||
| return nullptr, | |||
| "SetInt ATTR_NAME_INPUT_FORMAT failed."); | |||
| GE_CHK_BOOL_EXEC(AttrUtils::SetInt(op_def, ATTR_NAME_INPUT_DATATYPE, inDatatype), return nullptr, | |||
| GE_CHK_BOOL_EXEC(AttrUtils::SetInt(op_def, ATTR_NAME_INPUT_DATATYPE, inDatatype), | |||
| REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", ATTR_NAME_INPUT_DATATYPE.c_str(), | |||
| op_def->GetName().c_str(), op_def->GetType().c_str()); | |||
| return nullptr, | |||
| "SetInt ATTR_NAME_INPUT_DATATYPE failed."); | |||
| GE_CHK_BOOL_EXEC(AttrUtils::SetInt(op_def, ge::ATTR_NAME_OUTPUT_FORMAT, outFormat), return nullptr, | |||
| GE_CHK_BOOL_EXEC(AttrUtils::SetInt(op_def, ge::ATTR_NAME_OUTPUT_FORMAT, outFormat), | |||
| REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", ATTR_NAME_OUTPUT_FORMAT.c_str(), | |||
| op_def->GetName().c_str(), op_def->GetType().c_str()); | |||
| return nullptr, | |||
| "SetInt ATTR_NAME_INPUT_DATATYPE failed."); | |||
| GE_CHK_BOOL_EXEC(AttrUtils::SetInt(op_def, ATTR_NAME_OUTPUT_DATATYPE, outDatatype), return nullptr, | |||
| GE_CHK_BOOL_EXEC(AttrUtils::SetInt(op_def, ATTR_NAME_OUTPUT_DATATYPE, outDatatype), | |||
| REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", ATTR_NAME_OUTPUT_DATATYPE.c_str(), | |||
| op_def->GetName().c_str(), op_def->GetType().c_str()); | |||
| return nullptr, | |||
| "SetInt ATTR_NAME_INPUT_DATATYPE failed."); | |||
| if (inDatatype != ge::DT_FLOAT16) { | |||
| GE_CHK_BOOL_EXEC(SUCCESS == op_def->AddInputDesc(GeTensorDesc(GeShape(), inFormat)), return nullptr, | |||
| GE_CHK_BOOL_EXEC(SUCCESS == op_def->AddInputDesc(GeTensorDesc(GeShape(), inFormat)), | |||
| REPORT_CALL_ERROR("E19999", "Add input desc to op:%s(%s) failed", | |||
| op_def->GetName().c_str(), op_def->GetType().c_str()); | |||
| return nullptr, | |||
| "create translate op:add input desc fail."); | |||
| } else { | |||
| GE_CHK_BOOL_EXEC(SUCCESS == op_def->AddInputDesc(GeTensorDesc(GeShape(), inFormat, ge::DT_FLOAT16)), return nullptr, | |||
| GE_CHK_BOOL_EXEC(SUCCESS == op_def->AddInputDesc(GeTensorDesc(GeShape(), inFormat, ge::DT_FLOAT16)), | |||
| REPORT_CALL_ERROR("E19999", "Add input desc to op:%s(%s) failed", | |||
| op_def->GetName().c_str(), op_def->GetType().c_str()); | |||
| return nullptr, | |||
| "create translate op:add input desc fail."); | |||
| } | |||
| if (outDatatype != ge::DT_FLOAT16) { | |||
| GE_CHK_BOOL_EXEC(SUCCESS == op_def->AddOutputDesc(GeTensorDesc(GeShape(), outFormat)), return nullptr, | |||
| GE_CHK_BOOL_EXEC(SUCCESS == op_def->AddOutputDesc(GeTensorDesc(GeShape(), outFormat)), | |||
| REPORT_CALL_ERROR("E19999", "Add output desc to op:%s(%s) failed", | |||
| op_def->GetName().c_str(), op_def->GetType().c_str()); | |||
| return nullptr, | |||
| "create translate op:add output desc fail."); | |||
| } else { | |||
| GE_CHK_BOOL_EXEC(SUCCESS == op_def->AddOutputDesc(GeTensorDesc(GeShape(), outFormat, ge::DT_FLOAT16)), | |||
| REPORT_CALL_ERROR("E19999", "Add output desc to op:%s(%s) failed", | |||
| op_def->GetName().c_str(), op_def->GetType().c_str()); | |||
| return nullptr, "create translate op:add output desc fail."); | |||
| } | |||
| return op_def; | |||
| @@ -1938,17 +2234,29 @@ OpDescPtr ParserGraphOptimizer::CreatePermuteOp(enum ge::Format input_format, en | |||
| return op_desc); | |||
| GELOGI("create permute op:%s", op_desc->GetName().c_str()); | |||
| GE_CHK_BOOL_EXEC(AttrUtils::SetInt(op_desc, ge::ATTR_NAME_INPUT_FORMAT, (int64_t)input_format), return nullptr, | |||
| GE_CHK_BOOL_EXEC(AttrUtils::SetInt(op_desc, ge::ATTR_NAME_INPUT_FORMAT, (int64_t)input_format), | |||
| REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", ATTR_NAME_INPUT_FORMAT.c_str(), | |||
| op_desc->GetName().c_str(), op_desc->GetType().c_str()); | |||
| return nullptr, | |||
| "SetInt ATTR_NAME_INPUT_FORMAT failed."); | |||
| GE_CHK_BOOL_EXEC(AttrUtils::SetInt(op_desc, ge::ATTR_NAME_OUTPUT_FORMAT, (int64_t)output_format), return nullptr, | |||
| GE_CHK_BOOL_EXEC(AttrUtils::SetInt(op_desc, ge::ATTR_NAME_OUTPUT_FORMAT, (int64_t)output_format), | |||
| REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", ATTR_NAME_OUTPUT_FORMAT.c_str(), | |||
| op_desc->GetName().c_str(), op_desc->GetType().c_str()); | |||
| return nullptr, | |||
| "SetInt ATTR_NAME_OUTPUT_FORMAT failed."); | |||
| GE_IF_BOOL_EXEC(input_format == FORMAT_NCHW, (void)AttrUtils::SetInt(op_desc, "NCHW_to_NHWC", (int64_t)1)); | |||
| GE_IF_BOOL_EXEC(input_format == FORMAT_NHWC, (void)AttrUtils::SetInt(op_desc, "NHWC_to_NCHW", (int64_t)1)); | |||
| GE_CHK_BOOL_EXEC(SUCCESS == op_desc->AddInputDesc(GeTensorDesc(GeShape(), input_format)), return nullptr, | |||
| GE_CHK_BOOL_EXEC(SUCCESS == op_desc->AddInputDesc(GeTensorDesc(GeShape(), input_format)), | |||
| REPORT_CALL_ERROR("E19999", "Add input desc to op:%s(%s) failed", | |||
| op_desc->GetName().c_str(), op_desc->GetType().c_str()); | |||
| return nullptr, | |||
| "create permute op:add input desc fail."); | |||
| GE_CHK_BOOL_EXEC(SUCCESS == op_desc->AddOutputDesc(GeTensorDesc(GeShape(), output_format)), return nullptr, | |||
| GE_CHK_BOOL_EXEC(SUCCESS == op_desc->AddOutputDesc(GeTensorDesc(GeShape(), output_format)), | |||
| REPORT_CALL_ERROR("E19999", "Add output desc to op:%s(%s) failed", | |||
| op_desc->GetName().c_str(), op_desc->GetType().c_str()); | |||
| return nullptr, | |||
| "create permute op:add output desc fail."); | |||
| return op_desc; | |||
| @@ -1971,14 +2279,24 @@ OpDescPtr ParserGraphOptimizer::CreateCastOp(enum ge::DataType input_data_type, | |||
| AttrUtils::SetInt(op_desc, ge::CAST_ATTR_DSTT, (int64_t)output_data_type) && | |||
| AttrUtils::SetInt(op_desc, ge::CAST_ATTR_DST_TYPE, (int64_t)output_data_type) && | |||
| AttrUtils::SetBool(op_desc, ge::CAST_ATTR_TRUNCATE, false))) { | |||
| REPORT_CALL_ERROR("E19999", "Set Attr:%s or %s or %s or %s to op:%s(%s) failed", | |||
| CAST_ATTR_SRCT.c_str(), CAST_ATTR_DSTT.c_str(), | |||
| CAST_ATTR_DST_TYPE.c_str(), CAST_ATTR_TRUNCATE.c_str(), | |||
| op_desc->GetName().c_str(), op_desc->GetType().c_str()); | |||
| GELOGE(FAILED, "Set CAST_ATTR_SRCT or CAST_ATTR_DSTT or CAST_ATTR_DST_TYPE or CAST_ATTR_TRUNCATE fail, node: %s.", | |||
| op_desc->GetName().c_str()); | |||
| return nullptr; | |||
| } | |||
| GE_CHK_BOOL_EXEC(SUCCESS == op_desc->AddInputDesc(GeTensorDesc(GeShape(), format, input_data_type)), return nullptr, | |||
| GE_CHK_BOOL_EXEC(SUCCESS == op_desc->AddInputDesc(GeTensorDesc(GeShape(), format, input_data_type)), | |||
| REPORT_CALL_ERROR("E19999", "Add input desc to op:%s(%s) failed", | |||
| op_desc->GetName().c_str(), op_desc->GetType().c_str()); | |||
| return nullptr, | |||
| "create cast op:add input desc fail."); | |||
| GE_CHK_BOOL_EXEC(SUCCESS == op_desc->AddOutputDesc(GeTensorDesc(GeShape(), format, output_data_type)), return nullptr, | |||
| GE_CHK_BOOL_EXEC(SUCCESS == op_desc->AddOutputDesc(GeTensorDesc(GeShape(), format, output_data_type)), | |||
| REPORT_CALL_ERROR("E19999", "Add output desc to op:%s(%s) failed", | |||
| op_desc->GetName().c_str(), op_desc->GetType().c_str()); | |||
| return nullptr, | |||
| "create cast op:add output desc fail."); | |||
| return op_desc; | |||
| @@ -2000,13 +2318,25 @@ OpDescPtr ParserGraphOptimizer::CreateTransDataOp(enum ge::Format input_format) | |||
| output_format = FORMAT_NCHW; | |||
| } | |||
| GE_CHK_BOOL_EXEC(AttrUtils::SetInt(op_desc, ge::ATTR_NAME_INPUT_FORMAT, (int64_t)input_format), return nullptr, | |||
| GE_CHK_BOOL_EXEC(AttrUtils::SetInt(op_desc, ge::ATTR_NAME_INPUT_FORMAT, (int64_t)input_format), | |||
| REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", ATTR_NAME_INPUT_FORMAT.c_str(), | |||
| op_desc->GetName().c_str(), op_desc->GetType().c_str()); | |||
| return nullptr, | |||
| "SetInt of ATTR_NAME_INPUT_FORMAT failed."); | |||
| GE_CHK_BOOL_EXEC(AttrUtils::SetInt(op_desc, ge::ATTR_NAME_OUTPUT_FORMAT, (int64_t)output_format), return nullptr, | |||
| GE_CHK_BOOL_EXEC(AttrUtils::SetInt(op_desc, ge::ATTR_NAME_OUTPUT_FORMAT, (int64_t)output_format), | |||
| REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", ATTR_NAME_OUTPUT_FORMAT.c_str(), | |||
| op_desc->GetName().c_str(), op_desc->GetType().c_str()); | |||
| return nullptr, | |||
| "SetInt of ATTR_NAME_OUTPUT_FORMAT failed."); | |||
| GE_CHK_BOOL_EXEC(SUCCESS == op_desc->AddInputDesc(GeTensorDesc(GeShape(), input_format)), return nullptr, | |||
| GE_CHK_BOOL_EXEC(SUCCESS == op_desc->AddInputDesc(GeTensorDesc(GeShape(), input_format)), | |||
| REPORT_CALL_ERROR("E19999", "Add input desc to op:%s(%s) failed", | |||
| op_desc->GetName().c_str(), op_desc->GetType().c_str()); | |||
| return nullptr, | |||
| "create transdata op:add input desc fail."); | |||
| GE_CHK_BOOL_EXEC(SUCCESS == op_desc->AddOutputDesc(GeTensorDesc(GeShape(), output_format)), return nullptr, | |||
| GE_CHK_BOOL_EXEC(SUCCESS == op_desc->AddOutputDesc(GeTensorDesc(GeShape(), output_format)), | |||
| REPORT_CALL_ERROR("E19999", "Add output desc to op:%s(%s) failed", | |||
| op_desc->GetName().c_str(), op_desc->GetType().c_str()); | |||
| return nullptr, | |||
| "create transdata op:add output desc fail."); | |||
| return op_desc; | |||
| @@ -29,6 +29,7 @@ Status IteratorFusionPass::Run(ge::ComputeGraphPtr graph) { | |||
| domi::FrameworkType fmk_type = static_cast<domi::FrameworkType>(fmk_type_); | |||
| std::unique_ptr<ParserGraphOptimizer> graph_optimizer(new (std::nothrow) ParserGraphOptimizer(graph, fmk_type)); | |||
| if (graph_optimizer == nullptr) { | |||
| REPORT_CALL_ERROR("E19999", "New ParserGraphOptimizer failed"); | |||
| return FAILED; | |||
| } | |||
| @@ -27,6 +27,7 @@ shared_ptr<ScopeGraph> ScopePassManager::BuildScopeGraph(domi::tensorflow::Graph | |||
| GE_CHK_BOOL_EXEC(graph_def != nullptr, return nullptr, "graph_def is nullptr"); | |||
| scope_graph_ = ge::parser::MakeShared<ScopeGraph>(); | |||
| if (scope_graph_ == nullptr) { | |||
| REPORT_CALL_ERROR("E19999", "New ScopeGraph failed"); | |||
| GELOGE(FAILED, "Scope graph make shared failed."); | |||
| return nullptr; | |||
| } | |||
| @@ -59,6 +60,7 @@ Status ScopePassManager::Run(shared_ptr<ScopeGraph> &graph) { | |||
| auto &impl = pass->impl_; | |||
| if (impl == nullptr) { | |||
| GELOGE(ge::MEMALLOC_FAILED, "ScopeBasePass is not properly initialized."); | |||
| REPORT_INNER_ERROR("E19999", "ScopeBasePass is not properly initialized"); | |||
| continue; | |||
| } | |||
| @@ -38,12 +38,14 @@ const char *const kShapeAttrDtype = "dtype"; | |||
| Status TensorFlowAutoMappingParserAdapter::ParseParams(const Message *op_src, ge::OpDescPtr &op_dest) { | |||
| if (op_src == nullptr) { | |||
| REPORT_INNER_ERROR("E19999", "Param op_src is nullptr, check invalid"); | |||
| GELOGE(PARAM_INVALID, "Op src is null"); | |||
| return PARAM_INVALID; | |||
| } | |||
| const NodeDef *node = reinterpret_cast<const NodeDef *>(op_src); | |||
| GELOGD("TF op node name = %s, op type= %s, parse params", node->name().c_str(), node->op().c_str()); | |||
| if (op_dest == nullptr) { | |||
| REPORT_INNER_ERROR("E19999", "Param op_dest is nullptr, check invalid"); | |||
| GELOGE(FAILED, "Op dest is null"); | |||
| return PARAM_INVALID; | |||
| } | |||
| @@ -51,6 +53,7 @@ Status TensorFlowAutoMappingParserAdapter::ParseParams(const Message *op_src, ge | |||
| ge::Operator op = ge::OpDescUtils::CreateOperatorFromOpDesc(op_dest); | |||
| Status ret = domi::AutoMappingFn(op_src, op); | |||
| if (ret != SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "call auto mapping failed for node:%s", op.GetName().c_str()); | |||
| GELOGE(FAILED, "Tensorflow auto mapping parser params failed"); | |||
| return FAILED; | |||
| } | |||
| @@ -86,6 +89,8 @@ Status TensorFlowAutoMappingParserAdapter::ParseParams(const Message *op_src, ge | |||
| ge::DataType out_type = DT_INT32; | |||
| if (AttrUtils::GetDataType(op_dest, kShapeAttrOutType, out_type)) { | |||
| if (!AttrUtils::SetInt(op_dest, kShapeAttrDtype, static_cast<int64_t>(out_type))) { | |||
| REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", kShapeAttrDtype, | |||
| op_dest->GetName().c_str(), op_dest->GetType().c_str()); | |||
| GELOGE(FAILED, "Set attr dtype for op:%s failed.", op_dest->GetName().c_str()); | |||
| return FAILED; | |||
| } | |||
| @@ -104,6 +109,8 @@ Status TensorFlowAutoMappingParserAdapter::ParseParams(const Message *op_src, ge | |||
| // Serialize nodedef into string and package as a whole | |||
| string serialized_node; | |||
| GE_IF_BOOL_EXEC(!pkg_node->SerializeToString(&serialized_node), | |||
| REPORT_CALL_ERROR("E19999", "Trans NodeDef:%s(%s) to string failed", | |||
| pkg_node->name().c_str(), pkg_node->op().c_str()); | |||
| GELOGE(PARAM_INVALID, "In FrameworkOp trans NodeDef to string failed."); | |||
| return PARAM_INVALID); | |||
| @@ -68,7 +68,11 @@ Status TensorFlowConstantParser::ParseValue(const domi::tensorflow::NodeDef *nod | |||
| const domi::tensorflow::TensorProto &tensor = attr_value.tensor(); | |||
| GeTensorPtr weight = ge::parser::MakeShared<ge::GeTensor>(); | |||
| GE_CHECK_NOTNULL(weight); | |||
| if (weight == nullptr) { | |||
| REPORT_CALL_ERROR("E19999", "New GeTensor failed when parse node:%s", node->name().c_str()); | |||
| GELOGE(FAILED, "Create GeTensor fail when parse node:%s", node->name().c_str()); | |||
| return FAILED; | |||
| } | |||
| int64_t dataType = 0; | |||
| GE_CHK_BOOL_RET_STATUS(ge::AttrUtils::GetInt(opDesc, TENSORFLOW_ATTR_DTYPE, dataType), INTERNAL_ERROR, | |||
| "get dtype fail"); | |||
| @@ -32,9 +32,14 @@ Status TensorFlowCustomParserAdapter::ParseParams(const Message *op_src, ge::OpD | |||
| GE_CHECK_NOTNULL(op_dest); | |||
| ParseParamFunc custom_op_parser = domi::OpRegistry::Instance()->GetParseParamFunc(op_dest->GetType(), node_src->op()); | |||
| GE_CHECK_NOTNULL(custom_op_parser); | |||
| if (custom_op_parser == nullptr) { | |||
| REPORT_CALL_ERROR("E19999", "No ParseParamFunc of node:%s exist in OpRegistry", node_src->name().c_str()); | |||
| GELOGE(FAILED, "No ParseParamFunc of node:%s exist in OpRegistry", node_src->name().c_str()); | |||
| return FAILED; | |||
| } | |||
| ge::Operator op = ge::OpDescUtils::CreateOperatorFromOpDesc(op_dest); | |||
| GE_CHK_BOOL_RET_STATUS(custom_op_parser(op_src, op) == SUCCESS, FAILED, "Custom parser params failed"); | |||
| GE_CHK_BOOL_RET_STATUS(custom_op_parser(op_src, op) == SUCCESS, FAILED, "Custom parser params failed for node:%s", | |||
| node_src->name().c_str()); | |||
| op.BreakConnect(); | |||
| @@ -47,10 +52,15 @@ Status TensorFlowCustomParserAdapter::ParseParams(const Operator &op_src, ge::Op | |||
| GE_CHECK_NOTNULL(op_dest); | |||
| ParseParamByOpFunc custom_op_parser = domi::OpRegistry::Instance()->GetParseParamByOperatorFunc(op_src.GetOpType()); | |||
| GE_CHECK_NOTNULL(custom_op_parser); | |||
| ge::Operator op = ge::OpDescUtils::CreateOperatorFromOpDesc(op_dest); | |||
| GE_CHK_BOOL_RET_STATUS(custom_op_parser(op_src, op) == SUCCESS, FAILED, "Custom parser params failed"); | |||
| if (custom_op_parser == nullptr) { | |||
| REPORT_CALL_ERROR("E19999", "No ParseParamByOperatorFunc of node:%s exist in OpRegistry", op_src.GetName().c_str()); | |||
| GELOGE(FAILED, "No ParseParamByOperatorFunc of node:%s exist in OpRegistry", op_src.GetName().c_str()); | |||
| return FAILED; | |||
| } | |||
| ge::Operator op = ge::OpDescUtils::CreateOperatorFromOpDesc(op_dest); | |||
| GE_CHK_BOOL_RET_STATUS(custom_op_parser(op_src, op) == SUCCESS, FAILED, "Custom parser params failed or node:%s", | |||
| op_src.GetName().c_str()); | |||
| op_src.BreakConnect(); | |||
| return SUCCESS; | |||
| @@ -69,6 +69,9 @@ Status TensorFlowDataParser::ParseInputFromModel(const Message *op_src, ge::OpDe | |||
| domi::tensorflow::DataType tf_type = attr_value.type(); | |||
| ge::DataType type = domi::TensorAssign::ConvertTensorflowDataType(tf_type); | |||
| CHECK_FALSE_EXEC(type != ge::DataType::DT_UNDEFINED, | |||
| REPORT_CALL_ERROR("E19999", "Data type %s of node %s is not supported", | |||
| DataType_Name(tf_type).c_str(), | |||
| node->name().c_str()); | |||
| GELOGE(domi::PARAM_INVALID, | |||
| "Data type %s of node %s is not supported.", | |||
| DataType_Name(tf_type).c_str(), | |||
| @@ -76,7 +79,8 @@ Status TensorFlowDataParser::ParseInputFromModel(const Message *op_src, ge::OpDe | |||
| return domi::PARAM_INVALID); | |||
| GE_CHK_BOOL_RET_STATUS(ge::AttrUtils::SetInt(op_def, DATA_ATTR_NAME_DATA_TYPE, static_cast<int64_t>(type)), FAILED, | |||
| "SetInt failed"); | |||
| "SetAttr:%s to node:%s(%s) failed", DATA_ATTR_NAME_DATA_TYPE.c_str(), | |||
| op_def->GetName().c_str(), op_def->GetType().c_str()); | |||
| } | |||
| if (!TensorFlowUtil::FindAttrValue(node, TENSORFLOW_ATTR_SHAPE, attr_value)) { | |||
| @@ -139,7 +143,7 @@ Status TensorFlowDataParser::CheckInputShape(const std::string &name) { | |||
| // dim i = 0, means empty tensor. | |||
| // dim i = -1 or -2, means unknown shape. | |||
| GE_CHK_BOOL_RET_STATUS(user_input_dims_v[i] >= kValidShapeMinValue, domi::PARAM_INVALID, | |||
| "parse data node %s: shape contains placeholder ,but not designated by user", name.c_str()); | |||
| "parse data node %s: shape contains placeholder, but not designated by user", name.c_str()); | |||
| } | |||
| return SUCCESS; | |||
| } | |||
| @@ -34,24 +34,32 @@ Status TensorFlowEnterParser::ParseParams(const Message *op_src, ge::OpDescPtr & | |||
| const NodeDef *node = reinterpret_cast<const NodeDef *>(op_src); | |||
| domi::tensorflow::AttrValue str_attr; | |||
| if (!TensorFlowUtil::FindAttrValue(node, ENTER_ATTR_FRAME_NAME, str_attr)) { | |||
| REPORT_CALL_ERROR("E19999", "In NodeDef:%s attr:%s not exist, check invalid", | |||
| name.c_str(), ENTER_ATTR_FRAME_NAME.c_str()); | |||
| GELOGE(FAILED, "In NodeDef %s attr [%s] not exist.", name.c_str(), ENTER_ATTR_FRAME_NAME.c_str()); | |||
| return FAILED; | |||
| } | |||
| std::string frame_name = str_attr.s(); | |||
| GELOGI("Enter node: %s, attr frame_name: %s", name.c_str(), frame_name.c_str()); | |||
| if (!ge::AttrUtils::SetStr(op_desc, ENTER_ATTR_FRAME_NAME, frame_name)) { | |||
| REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", ENTER_ATTR_FRAME_NAME.c_str(), | |||
| op_desc->GetName().c_str(), op_desc->GetType().c_str()); | |||
| GELOGE(FAILED, "Set attr ENTER_ATTR_FRAME_NAME fail, node: %s", name.c_str()); | |||
| return FAILED; | |||
| } | |||
| domi::tensorflow::AttrValue bool_attr; | |||
| if (!TensorFlowUtil::FindAttrValue(node, ENTER_ATTR_CONSTANT_FLAG, bool_attr)) { | |||
| REPORT_CALL_ERROR("E19999", "In NodeDef:%s attr:%s not exist, check invalid", | |||
| name.c_str(), ENTER_ATTR_CONSTANT_FLAG.c_str()); | |||
| GELOGE(FAILED, "In NodeDef %s attr [%s] not exist.", name.c_str(), ENTER_ATTR_CONSTANT_FLAG.c_str()); | |||
| return FAILED; | |||
| } | |||
| bool is_constant = bool_attr.b(); | |||
| GELOGI("Enter node: %s, attr is_constant: %s", name.c_str(), is_constant ? "true" : "false"); | |||
| if (!ge::AttrUtils::SetBool(op_desc, ENTER_ATTR_CONSTANT_FLAG, is_constant)) { | |||
| REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", ENTER_ATTR_CONSTANT_FLAG.c_str(), | |||
| op_desc->GetName().c_str(), op_desc->GetType().c_str()); | |||
| GELOGE(FAILED, "Set attr ENTER_ATTR_CONSTANT_FLAG fail, node: %s", name.c_str()); | |||
| return FAILED; | |||
| } | |||
| @@ -48,6 +48,9 @@ domi::Status ParseParams(const NodeDef *node, FillOperator *op) { | |||
| ge::DataType type = domi::TensorAssign::ConvertTensorflowDataType(data_type); | |||
| CHECK_FALSE_EXEC( | |||
| type != ge::DataType::DT_UNDEFINED, | |||
| REPORT_CALL_ERROR("E19999", "Data type %s of node %s is not supported", | |||
| DataType_Name(data_type).c_str(), | |||
| node->name().c_str()); | |||
| GELOGE(PARAM_INVALID, "Data type %s of node %s is not supported.", DataType_Name(data_type).c_str(), | |||
| node->name().c_str()); | |||
| return PARAM_INVALID); | |||
| @@ -76,6 +76,8 @@ Status ParseParams(const Message *op_src, FrameworkOpOperator *op) { | |||
| } else { | |||
| GE_CHK_BOOL_EXEC(type == "_Retval", | |||
| GE_DELETE_NEW_SINGLE(pkg_node); | |||
| REPORT_INNER_ERROR("E19999", "In NodeDef:%s Attr:opdef is not exist, check invalid", | |||
| pkg_node->name().c_str()); | |||
| return PARAM_INVALID, "In NodeDef %s Attr opdef is not exist.", pkg_node->name().c_str()); | |||
| } | |||
| @@ -97,6 +99,8 @@ Status ParseParams(const Message *op_src, FrameworkOpOperator *op) { | |||
| // Serialize nodedef into string and package as a whole | |||
| string serialized_node; | |||
| GE_IF_BOOL_EXEC(!pkg_node->SerializeToString(&serialized_node), | |||
| REPORT_CALL_ERROR("E19999", "Trans NodeDef:%s(%s) to string failed", | |||
| pkg_node->name().c_str(), pkg_node->op().c_str()); | |||
| GELOGE(PARAM_INVALID, "In FrameworkOp trans NodeDef to string failed."); | |||
| GE_DELETE_NEW_SINGLE(pkg_node); return PARAM_INVALID); | |||
| @@ -40,10 +40,18 @@ Status TensorFlowFusionCustomParserAdapter::ParseParams(const vector<const NodeD | |||
| (void)ge::AttrUtils::GetStr(node->GetOpDesc(), ge::ATTR_NAME_FUSIONOP_ORIGINAL_TYPE, ori_type); | |||
| FusionParseParamFunc | |||
| custom_op_parser = domi::OpRegistry::Instance()->GetFusionParseParamFunc(op_dest->GetType(), ori_type); | |||
| GE_CHECK_NOTNULL(custom_op_parser); | |||
| if (custom_op_parser == nullptr) { | |||
| REPORT_CALL_ERROR("E19999", "No FusionParseParamFunc of node:%s(%s) exist in OpRegistry", | |||
| node->GetName().c_str(), node->GetType().c_str()); | |||
| GELOGE(FAILED, "No FusionParseParamFunc of node:%s(%s) exist in OpRegistry", | |||
| node->GetName().c_str(), node->GetType().c_str()); | |||
| return FAILED; | |||
| } | |||
| GELOGI("Get fusion parser succ, node: %s.", node->GetName().c_str()); | |||
| ge::Operator op = ge::OpDescUtils::CreateOperatorFromOpDesc(op_dest); | |||
| GE_CHK_BOOL_RET_STATUS(custom_op_parser(inside_nodes, op) == SUCCESS, FAILED, "Custom parser params failed"); | |||
| GE_CHK_BOOL_RET_STATUS(custom_op_parser(inside_nodes, op) == SUCCESS, FAILED, | |||
| "Custom parse params failed for node:%s(%s)", | |||
| node->GetName().c_str(), node->GetType().c_str()); | |||
| op.BreakConnect(); | |||
| GELOGI("Run fusion parser succ, node: %s.", node->GetName().c_str()); | |||
| @@ -61,9 +69,17 @@ Status TensorFlowFusionCustomParserAdapter::ParseParams(const std::vector<ge::Op | |||
| (void)ge::AttrUtils::GetStr(node->GetOpDesc(), ge::ATTR_NAME_FUSIONOP_ORIGINAL_TYPE, ori_type); | |||
| FusionParseParamByOpFunc | |||
| custom_op_parser = domi::OpRegistry::Instance()->GetFusionParseParamByOpFunc(op_dest->GetType(), ori_type); | |||
| GE_CHECK_NOTNULL(custom_op_parser); | |||
| if (custom_op_parser == nullptr) { | |||
| REPORT_CALL_ERROR("E19999", "No FusionParseParamByOpFunc of node:%s(%s) exist in OpRegistry", | |||
| node->GetName().c_str(), node->GetType().c_str()); | |||
| GELOGE(FAILED, "No FusionParseParamByOpFunc of node:%s(%s) exist in OpRegistry", | |||
| node->GetName().c_str(), node->GetType().c_str()); | |||
| return FAILED; | |||
| } | |||
| ge::Operator op = ge::OpDescUtils::CreateOperatorFromOpDesc(op_dest); | |||
| GE_CHK_BOOL_RET_STATUS(custom_op_parser(v_input_const, op) == SUCCESS, FAILED, "Custom parser params failed"); | |||
| GE_CHK_BOOL_RET_STATUS(custom_op_parser(v_input_const, op) == SUCCESS, FAILED, | |||
| "Custom parser params failedfor node:%s(%s)", | |||
| node->GetName().c_str(), node->GetType().c_str()); | |||
| for (const auto &op_src : v_input_const) { | |||
| op_src.BreakConnect(); | |||
| @@ -27,27 +27,31 @@ using domi::tensorflow::DataType; | |||
| using domi::tensorflow::NodeDef; | |||
| namespace ge { | |||
| #define GET_CONST_VALUE(tensor, param, index, FIELD) \ | |||
| do { \ | |||
| google::protobuf::RepeatedField<FIELD> val_vec; \ | |||
| int32_t val_size = 0; \ | |||
| val_vec = tensor.FIELD##_val(); \ | |||
| val_size = val_vec.size(); \ | |||
| if (index < val_size) { \ | |||
| param = val_vec.Get(index); \ | |||
| } else if (tensor.has_tensor_shape()) { \ | |||
| const std::string tensor_content = tensor.tensor_content(); \ | |||
| char *buf = const_cast<char *>(tensor_content.data()); \ | |||
| FIELD *buf_v = reinterpret_cast<FIELD *>(buf); \ | |||
| if (static_cast<uint32_t>(index) >= tensor_content.length() / sizeof(FIELD)) { \ | |||
| GELOGE(domi::PARAM_INVALID, "Const data size is smaller than index :%d,not supported!", index); \ | |||
| return domi::PARAM_INVALID; \ | |||
| } \ | |||
| param = buf_v[index]; \ | |||
| } else { \ | |||
| GELOGE(domi::PARAM_INVALID, "Const data size is smaller than index :%d,not supported!", index); \ | |||
| return domi::PARAM_INVALID; \ | |||
| } \ | |||
| #define GET_CONST_VALUE(tensor, param, index, FIELD) \ | |||
| do { \ | |||
| google::protobuf::RepeatedField<FIELD> val_vec; \ | |||
| int32_t val_size = 0; \ | |||
| val_vec = tensor.FIELD##_val(); \ | |||
| val_size = val_vec.size(); \ | |||
| if (index < val_size) { \ | |||
| param = val_vec.Get(index); \ | |||
| } else if (tensor.has_tensor_shape()) { \ | |||
| const std::string tensor_content = tensor.tensor_content(); \ | |||
| char *buf = const_cast<char *>(tensor_content.data()); \ | |||
| FIELD *buf_v = reinterpret_cast<FIELD *>(buf); \ | |||
| if (static_cast<uint32_t>(index) >= tensor_content.length() / sizeof(FIELD)) { \ | |||
| REPORT_INNER_ERROR("E19999", "Const data size of node:%s is smaller than index:%d, not supported!", \ | |||
| node_def->name().c_str(), index); \ | |||
| GELOGE(domi::PARAM_INVALID, "Const data size is smaller than index :%d,not supported!", index); \ | |||
| return domi::PARAM_INVALID; \ | |||
| } \ | |||
| param = buf_v[index]; \ | |||
| } else { \ | |||
| REPORT_INNER_ERROR("E19999", "Const data size of node:%s is smaller than index:%d, not supported!", \ | |||
| node_def->name().c_str(), index); \ | |||
| GELOGE(domi::PARAM_INVALID, "Const data size is smaller than index :%d,not supported!", index); \ | |||
| return domi::PARAM_INVALID; \ | |||
| } \ | |||
| } while (false) | |||
| Status TensorFlowFusionOpParser::GetTensorFromNode(const NodeDef *node_def, TensorProto &tensor) { | |||
| @@ -59,6 +63,8 @@ Status TensorFlowFusionOpParser::GetTensorFromNode(const NodeDef *node_def, Tens | |||
| domi::tensorflow::AttrValue attr_value; | |||
| // Check that the attribute value must exist and get the value. | |||
| if (!TensorFlowUtil::FindAttrValue(node_def, TENSORFLOW_ATTR_VALUE, attr_value)) { | |||
| REPORT_CALL_ERROR("E19999", "In NodeDef:%s attr:%s not exist, check invalid", | |||
| node_def->name().c_str(), TENSORFLOW_ATTR_VALUE.c_str()); | |||
| GELOGE(domi::PARAM_INVALID, "NodeDef %s Attr %s is not exist.", node_name.c_str(), TENSORFLOW_ATTR_VALUE.c_str()); | |||
| return domi::PARAM_INVALID; | |||
| } | |||
| @@ -116,10 +122,13 @@ Status TensorFlowFusionOpParser::ParseHalfFromConst(const NodeDef *node_def, flo | |||
| ge::parser::fp16_t fp16_value = static_cast<parser::fp16_t>(val_vec.Get(index)); | |||
| param = fp16_value.ToFloat(); | |||
| } else { | |||
| REPORT_INNER_ERROR("E19999", "Const data size:%d of node:%s <= index:%d, not supported!", | |||
| val_size, node_def->name().c_str(), index); | |||
| GELOGE(domi::PARAM_INVALID, "Const data size is smaller than index:%d, not supported.", index); | |||
| return domi::PARAM_INVALID; | |||
| } | |||
| } else { | |||
| REPORT_INNER_ERROR("E19999", "Node %s does not have half value, index:%d.", node_def->name().c_str(), index); | |||
| GELOGE(domi::PARAM_INVALID, "Node %s does not have half value, index:%d.", node_def->name().c_str(), index); | |||
| return domi::PARAM_INVALID; | |||
| } | |||
| @@ -131,7 +140,11 @@ Status TensorFlowFusionOpParser::ParseWeightFromConst(const NodeDef *node_def, g | |||
| TensorProto tensor; | |||
| GE_CHK_STATUS_RET(GetTensorFromNode(node_def, tensor), "get tensor failed."); | |||
| weight = ge::parser::MakeShared<ge::GeTensor>(); | |||
| GE_CHECK_NOTNULL(weight); | |||
| if (weight == nullptr) { | |||
| REPORT_CALL_ERROR("E19999", "New GeTensor failed for node:%s", node_def->name().c_str()); | |||
| GELOGE(domi::PARAM_INVALID, "New GeTensor failed for node:%s", node_def->name().c_str()); | |||
| return domi::PARAM_INVALID; | |||
| } | |||
| domi::tensorflow::DataType data_type = tensor.dtype(); | |||
| GE_CHK_STATUS_RET( | |||
| domi::TensorAssign::SetGeTensorDataType(domi::TensorAssign::ConvertTensorflowDataType(data_type), weight), | |||
| @@ -40,6 +40,8 @@ Status TensorFlowMergeParser::ParseParams(const Message *op_src, ge::OpDescPtr & | |||
| // add dynamic input | |||
| graphStatus ret = op_desc->AddDynamicInputDesc("x", input_tensor_num); | |||
| if (ret != GRAPH_SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Add Dynamic InputDesc name:x to node:%s(%s) failed", | |||
| op_desc->GetName().c_str(), op_desc->GetType().c_str()); | |||
| GELOGE(FAILED, "Add dynamic input:x for node:%s failed.", op_desc->GetName().c_str()); | |||
| return FAILED; | |||
| } | |||
| @@ -88,7 +88,7 @@ using ge::parser::ModelSaver; | |||
| namespace ge { | |||
| graphStatus aclgrphParseTensorFlow(const char *model_file, ge::Graph &graph) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kParser); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kParser); | |||
| GE_CHECK_NOTNULL(model_file); | |||
| GetParserContext().type = domi::TENSORFLOW; | |||
| std::map<string, string> options; | |||
| @@ -104,11 +104,19 @@ graphStatus aclgrphParseTensorFlow(const char *model_file, ge::Graph &graph) { | |||
| // Create an empty computegraph | |||
| ge::ComputeGraphPtr compute_graph = ge::parser::MakeShared<ge::ComputeGraph>("tmpGraph"); | |||
| GE_CHECK_NOTNULL(compute_graph); | |||
| if (compute_graph == nullptr) { | |||
| REPORT_CALL_ERROR("E19999", "New ComputeGraph failed"); | |||
| GELOGE(FAILED, "Create ComputeGraph fail."); | |||
| return FAILED; | |||
| } | |||
| graph = ge::GraphUtils::CreateGraphFromComputeGraph(compute_graph); | |||
| auto model_parser = domi::ModelParserFactory::Instance()->CreateModelParser(domi::TENSORFLOW); | |||
| GE_CHECK_NOTNULL(model_parser); | |||
| if (model_parser == nullptr) { | |||
| REPORT_CALL_ERROR("E19999", "No Model Parser for tensorflow, check invalid"); | |||
| GELOGE(GRAPH_FAILED, "No Model Parser for tensorflow, check invalid"); | |||
| return FAILED; | |||
| } | |||
| // parse tensorflow model_file to GE graph | |||
| ge::graphStatus ret = model_parser->Parse(model_file, graph); | |||
| @@ -128,7 +136,7 @@ graphStatus aclgrphParseTensorFlow(const char *model_file, ge::Graph &graph) { | |||
| graphStatus aclgrphParseTensorFlow(const char *model_file, const std::map<AscendString, AscendString> &parser_params, | |||
| ge::Graph &graph) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kParser); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kParser); | |||
| GE_CHECK_NOTNULL(model_file); | |||
| GetParserContext().type = domi::TENSORFLOW; | |||
| std::map<string, string> options; | |||
| @@ -150,11 +158,19 @@ graphStatus aclgrphParseTensorFlow(const char *model_file, const std::map<Ascend | |||
| // Create an empty computegraph | |||
| string graph_name = output_name.empty() ? "tmpGraph" : output_name; | |||
| ge::ComputeGraphPtr compute_graph = ge::parser::MakeShared<ge::ComputeGraph>(graph_name); | |||
| GE_CHECK_NOTNULL(compute_graph); | |||
| if (compute_graph == nullptr) { | |||
| REPORT_CALL_ERROR("E19999", "New ComputeGraph failed"); | |||
| GELOGE(FAILED, "Create ComputeGraph fail."); | |||
| return FAILED; | |||
| } | |||
| graph = ge::GraphUtils::CreateGraphFromComputeGraph(compute_graph); | |||
| auto model_parser = domi::ModelParserFactory::Instance()->CreateModelParser(domi::TENSORFLOW); | |||
| GE_CHECK_NOTNULL(model_parser); | |||
| if (model_parser == nullptr) { | |||
| REPORT_CALL_ERROR("E19999", "No Model Parser for tensorflow, check invalid"); | |||
| GELOGE(GRAPH_FAILED, "No Model Parser for tensorflow, check invalid"); | |||
| return FAILED; | |||
| } | |||
| // parse tensorflow model_file to GE graph | |||
| ge::graphStatus ret = model_parser->Parse(model_file, graph); | |||
| @@ -218,11 +234,14 @@ Status GenSubgraphParseTasks(const ge::ComputeGraphPtr &parent_graph, std::deque | |||
| auto unique_name = node->GetName() + std::to_string(i) + subgraph_iname; | |||
| auto subgraph = ge::parser::MakeShared<ge::ComputeGraph>(unique_name); | |||
| if (subgraph == nullptr) { | |||
| REPORT_CALL_ERROR("E19999", "New ComputeGraph failed when create subgraph:%s", subgraph_iname.c_str()); | |||
| GELOGE(OUT_OF_MEMORY, "Failed to alloc subgraph %s", subgraph_iname.c_str()); | |||
| return OUT_OF_MEMORY; | |||
| } | |||
| auto ret = ge::NodeUtils::SetSubgraph(*node, i, subgraph); | |||
| if (ret != SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Set subgraph:%s to node:%s(%s) failed, index:%u", | |||
| subgraph_iname.c_str(), node->GetName().c_str(), node->GetType().c_str(), i); | |||
| GELOGE(ret, "Failed to set subgraph %s to node %s index %u", subgraph_iname.c_str(), node->GetName().c_str(), | |||
| i); | |||
| return ret; | |||
| @@ -273,6 +292,9 @@ Status PostOpProcessForSubgraph(const ParseArg &arg) { | |||
| ret = parse_func_v2(arg.subgraph_name.c_str(), graph); | |||
| } | |||
| if (ret != SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Call ParseSubgraphPostFunc:%s failed, subgraph:%s, node:%s(%s), ret:0x%X", | |||
| arg.function_name.c_str(), arg.subgraph_name.c_str(), | |||
| arg.parent_node->GetName().c_str(), arg.parent_node->GetType().c_str(), ret); | |||
| GELOGE(FAILED, "Failed to post-process subgraph %s on node %s type %s subgraph name %s", arg.function_name.c_str(), | |||
| arg.parent_node->GetName().c_str(), arg.parent_node->GetType().c_str(), arg.subgraph_name.c_str()); | |||
| return FAILED; | |||
| @@ -312,6 +334,8 @@ Status TensorFlowModelParser::DefunToPartitionedCall(const domi::tensorflow::Nod | |||
| for (size_t i = 0; i < input_tensor_num; ++i) { | |||
| ge::GeTensorDesc input_tensor; | |||
| if (op->AddInputDesc(input_tensor) != ge::GRAPH_SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Add input desc to op:%s(%s) failed", | |||
| op->GetName().c_str(), op->GetType().c_str()); | |||
| GELOGE(FAILED, "op [%s] type[%s] add input(%zu) tensor failed.", op_name.c_str(), op->GetType().c_str(), i); | |||
| return FAILED; | |||
| } | |||
| @@ -320,6 +344,8 @@ Status TensorFlowModelParser::DefunToPartitionedCall(const domi::tensorflow::Nod | |||
| for (size_t i = 0; i < output_tensor_num; ++i) { | |||
| ge::GeTensorDesc output_tensor; | |||
| if (op->AddOutputDesc(output_tensor) != ge::GRAPH_SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Add output desc to op:%s(%s) failed", | |||
| op->GetName().c_str(), op->GetType().c_str()); | |||
| GELOGE(FAILED, "op [%s] type[%s] add output(%zu) tensor failed.", op_name.c_str(), op->GetType().c_str(), i); | |||
| return FAILED; | |||
| } | |||
| @@ -388,6 +414,8 @@ Status TensorFlowModelParser::ParseOpParams(const domi::tensorflow::NodeDef *nod | |||
| ge::Operator op_src(node_def->name(), node_def->op()); | |||
| status = domi::AutoMappingFn(node_def, op_src); | |||
| if (status != SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Auto mapping node_def:%s(%s) to operator failed", | |||
| node_def->name().c_str(), node_def->op().c_str()); | |||
| GELOGE(status, "Node[%s] auto mapping failed.", node_name.c_str()); | |||
| return status; | |||
| } | |||
| @@ -477,6 +505,7 @@ Status TensorFlowModelParser::AddNode(const domi::tensorflow::NodeDef *node_def, | |||
| // Find all children of the fusion operator | |||
| auto iter = fusion_op_nodedef_map_.find(node_def->name()); | |||
| if (iter == fusion_op_nodedef_map_.end()) { | |||
| REPORT_INNER_ERROR("E19999", "FusionOp node %s has no children node, check invalid", node_name.c_str()); | |||
| GELOGE(FAILED, "FusionOp node %s has no children node!", node_name.c_str()); | |||
| return INTERNAL_ERROR; | |||
| } | |||
| @@ -764,7 +793,11 @@ Status TensorFlowModelParser::CheckOpShapeDim(const domi::tensorflow::NodeDef *n | |||
| bool is_attr_exist = | |||
| ge::TensorFlowUtil::FindAttrValue(node_def, ge::parser::ATTR_NAME_INPUT_TENSOR_DESC, input_attr_value); | |||
| GE_IF_BOOL_EXEC(!is_attr_exist, return SUCCESS); | |||
| GE_CHK_BOOL_EXEC(input_attr_value.has_list(), return PARAM_INVALID, "output attr value vector is empty"); | |||
| GE_CHK_BOOL_EXEC(input_attr_value.has_list(), | |||
| REPORT_INNER_ERROR("E19999", "Attr:%s of node_def:%s(%s) is empty, check invalid", | |||
| ge::parser::ATTR_NAME_INPUT_TENSOR_DESC.c_str(), | |||
| node_def->name().c_str(), node_def->op().c_str()); | |||
| return PARAM_INVALID, "output attr value vector is empty"); | |||
| // list contain many TensorDescriptors | |||
| domi::tensorflow::AttrValue_ListValue a_list = input_attr_value.list(); | |||
| @@ -828,7 +861,9 @@ ge::DataType TensorFlowModelParser::ConvertToGeDataType(const uint32_t type) { | |||
| Status TensorFlowModelParser::ParseNodeDef(TensorFlowModelParser *parser, ge::ComputeGraphPtr &graph, | |||
| std::mutex *graphMutex, shared_ptr<ge::ScopeGraph> &scope_graph, | |||
| const domi::tensorflow::NodeDef *node_def) { | |||
| const domi::tensorflow::NodeDef *node_def, | |||
| error_message::Context error_context) { | |||
| ErrorManager::GetInstance().SetErrorContext(error_context); | |||
| // The caller guarantees that the pointer is not null | |||
| string node_name = node_def->name(); | |||
| string node_op = node_def->op(); | |||
| @@ -839,7 +874,10 @@ Status TensorFlowModelParser::ParseNodeDef(TensorFlowModelParser *parser, ge::Co | |||
| } | |||
| auto iterator = parser->adaptedOpTypeMap_.find(node_name); | |||
| GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(iterator == parser->adaptedOpTypeMap_.end(), return FAILED, | |||
| GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(iterator == parser->adaptedOpTypeMap_.end(), | |||
| REPORT_INNER_ERROR("E19999", "get adapted op type failed, node name = %s", | |||
| node_name.c_str()); | |||
| return FAILED, | |||
| "get adapted op type failed, node name = %s", node_name.c_str()); | |||
| string op_type = iterator->second; | |||
| @@ -879,6 +917,8 @@ Status TensorFlowModelParser::ParseNodeDef(TensorFlowModelParser *parser, ge::Co | |||
| } | |||
| return SUCCESS; | |||
| } else { | |||
| REPORT_INPUT_ERROR("E12011", std::vector<std::string>({"opname", "optype"}), | |||
| std::vector<std::string>({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; | |||
| } | |||
| @@ -931,7 +971,11 @@ Status TensorFlowModelParser::ParseNodeDef(TensorFlowModelParser *parser, ge::Co | |||
| node = graph->AddNode(op); | |||
| } | |||
| GE_CHK_BOOL_TRUE_EXEC_WITH_LOG((node == nullptr), return INTERNAL_ERROR, "add node failed."); | |||
| GE_CHK_BOOL_TRUE_EXEC_WITH_LOG((node == nullptr), | |||
| REPORT_CALL_ERROR("E19999", "Add node:%s(%s) to graph:%s failed", | |||
| op->GetName().c_str(), op->GetType().c_str(), | |||
| graph->GetName().c_str()); | |||
| return INTERNAL_ERROR, "add node failed."); | |||
| if (needFusion) { | |||
| shared_ptr<OpParser> fusion_op_parser = factory->CreateFusionOpParser(op_type); | |||
| @@ -996,7 +1040,8 @@ Status TensorFlowModelParser::AddFmkNode(ge::ComputeGraphPtr &graph, shared_ptr< | |||
| const domi::tensorflow::NodeDef *node_def = nodedef_map_[op_node_name]; | |||
| GE_CHECK_NOTNULL(node_def); | |||
| std::future<Status> f = | |||
| executor.commit(TensorFlowModelParser::ParseNodeDef, this, graph_tmp, &graphMutex, scope_graph, node_def); | |||
| executor.commit(TensorFlowModelParser::ParseNodeDef, this, graph_tmp, &graphMutex, scope_graph, node_def, | |||
| ErrorManager::GetInstance().GetErrorManagerContext()); | |||
| if (!f.valid()) { | |||
| GELOGE(FAILED, "Future is invalid"); | |||
| return FAILED; | |||
| @@ -1026,7 +1071,10 @@ Status TensorFlowModelParser::AddNodeToGraphAndMarkFormat(ge::ComputeGraphPtr &g | |||
| for (size_t j = 0; j < op_node_list_size; j++) { | |||
| const string op_node_name = op_node_name_list[j]; | |||
| auto iterator = node_map_.find(op_node_name); | |||
| GE_CHK_BOOL_TRUE_EXEC_WITH_LOG((iterator == node_map_.end()), return INTERNAL_ERROR, "add node failed."); | |||
| GE_CHK_BOOL_TRUE_EXEC_WITH_LOG((iterator == node_map_.end()), | |||
| REPORT_INNER_ERROR("E19999", "node:%s can't find in node_map_, check invalid", | |||
| op_node_name.c_str()); | |||
| return INTERNAL_ERROR, "add node failed."); | |||
| GE_CHECK_NOTNULL(iterator->second); | |||
| GE_CHK_STATUS_RET(iterator->second->SetOwnerComputeGraph(graph), "set owner compute graph failed"); | |||
| graph->AddNode(iterator->second); | |||
| @@ -1052,6 +1100,7 @@ Status TensorFlowModelParser::ExcuteScopeFusionPasses(domi::tensorflow::GraphDef | |||
| ge::StringUtils::Split(ge::GetParserContext().enable_scope_fusion_passes, ','); | |||
| auto &impl = ge::ScopeFusionPassRegistry::GetInstance().impl_; | |||
| if (impl == nullptr) { | |||
| REPORT_INNER_ERROR("E19999", "ScopeFusionPassRegistry is not properly initialized."); | |||
| GELOGE(ge::MEMALLOC_FAILED, "ScopeFusionPassRegistry is not properly initialized."); | |||
| return ge::MEMALLOC_FAILED; | |||
| } | |||
| @@ -1076,7 +1125,7 @@ Status TensorFlowModelParser::ExcuteScopeFusionPasses(domi::tensorflow::GraphDef | |||
| } | |||
| Status TensorFlowModelParser::ParseFromMemory(const char *data, uint32_t size, ge::ComputeGraphPtr &graph) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kParser); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kParser); | |||
| GE_CHECK_NOTNULL(data); | |||
| GE_CHECK_NOTNULL(graph); | |||
| @@ -1084,7 +1133,9 @@ Status TensorFlowModelParser::ParseFromMemory(const char *data, uint32_t size, g | |||
| domi::tensorflow::GraphDef OriDef; | |||
| bool read = ge::parser::ReadProtoFromArray(data, static_cast<int>(size), &OriDef); | |||
| GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(!read, return INTERNAL_ERROR, "read_proto_from_binary failed."); | |||
| GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(!read, | |||
| REPORT_INNER_ERROR("E19999", "read graph proto from binary failed"); | |||
| return INTERNAL_ERROR, "read_proto_from_binary failed."); | |||
| domi::tensorflow::GraphDef graph_def; | |||
| if (ge::GetParserContext().input_dims.empty() && ge::GetParserContext().out_nodes_map.empty()) { | |||
| @@ -1168,12 +1219,14 @@ Status TensorFlowModelParser::ParseFromMemory(const char *data, uint32_t size, g | |||
| const string op_node_name = op_node_name_list[i]; | |||
| const domi::tensorflow::NodeDef *node_def = nodedef_map_[op_node_name_list[i]]; | |||
| if (node_def == nullptr) { | |||
| REPORT_INNER_ERROR("E19999", "Node:%s can't find in nodedef_map_, check invalid", op_node_name.c_str()); | |||
| GELOGE(INTERNAL_ERROR, "Node def is nullptr, name:%s.", op_node_name.c_str()); | |||
| DeleteFuisonNodeDef(); | |||
| return INTERNAL_ERROR; | |||
| } | |||
| const string &node_op = node_def->op(); | |||
| GE_CHK_BOOL_TRUE_EXEC_WITH_LOG((tensorflow_op_map.find(node_op) == tensorflow_op_map.end()), DeleteFuisonNodeDef(); | |||
| REPORT_INNER_ERROR("E19999", "Op type %s unsupport", node_op.c_str()); | |||
| return INTERNAL_ERROR, "Unsupport op type %s", node_op.c_str()); | |||
| ret = AddNode(node_def, graph, scope_graph); | |||
| @@ -1219,7 +1272,7 @@ Status TensorFlowModelParser::GetFunctionProto(const string &file, | |||
| } | |||
| Status TensorFlowModelParser::Parse(const char *model_path, ge::Graph &graph) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kParser); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kParser); | |||
| GE_CHECK_NOTNULL(model_path); | |||
| ge::ComputeGraphPtr root_graph = ge::GraphUtils::GetComputeGraph(graph); | |||
| GE_CHECK_NOTNULL(root_graph); | |||
| @@ -1313,7 +1366,7 @@ Status TensorFlowModelParser::Parse(const char *model_path, ge::ComputeGraphPtr | |||
| } | |||
| Status TensorFlowModelParser::ParseAllGraph(const google::protobuf::Message *proto, ge::ComputeGraphPtr &graph) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kParser); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kParser); | |||
| GE_CHECK_NOTNULL(proto); | |||
| GE_CHECK_NOTNULL(graph); | |||
| @@ -1410,6 +1463,7 @@ Status TensorFlowModelParser::ParseAllGraph(const google::protobuf::Message *pro | |||
| const string op_node_name = op_node_name_list[i]; | |||
| const domi::tensorflow::NodeDef *node_def = nodedef_map_[op_node_name_list[i]]; | |||
| if (node_def == nullptr) { | |||
| REPORT_INNER_ERROR("E19999", "Node:%s can't find in nodedef_map_, check invalid", op_node_name.c_str()); | |||
| GELOGE(INTERNAL_ERROR, "Cannot find [%s] in nodedef map.", op_node_name_list[i].c_str()); | |||
| DeleteFuisonNodeDef(); | |||
| return INTERNAL_ERROR; | |||
| @@ -1613,6 +1667,7 @@ Status TensorFlowModelParser::RunScopeFusionPass(const vector<string> &scope_pas | |||
| GE_CHECK_NOTNULL(scope_graph); | |||
| auto &impl = ge::ScopeFusionPassRegistry::GetInstance().impl_; | |||
| if (impl == nullptr) { | |||
| REPORT_INNER_ERROR("E19999", "ScopeFusionPassRegistry is not properly initialized."); | |||
| GELOGE(ge::MEMALLOC_FAILED, "ScopeFusionPassRegistry is not properly initialized."); | |||
| return ge::MEMALLOC_FAILED; | |||
| } | |||
| @@ -1677,7 +1732,9 @@ bool TensorFlowModelParser::MaybeFusionOp(shared_ptr<ge::ScopeGraph> &scope_grap | |||
| } | |||
| bool TensorFlowModelParser::IsFusionOpChild(const string &node_name, ge::ScopeFusionOpInfo *info) { | |||
| GE_CHK_BOOL_EXEC(info != nullptr, return false, "fusion info is null."); | |||
| GE_CHK_BOOL_EXEC(info != nullptr, | |||
| REPORT_CALL_ERROR("E19999", "Param info is nullptr, check invalid"); | |||
| return false, "fusion info is null."); | |||
| // 1.View in full match fusion strategy first | |||
| // 2.View in scope fusion policy then | |||
| auto iter = fusion_op_children_.find(node_name); | |||
| @@ -2146,7 +2203,7 @@ Status TensorFlowWeightsParser::ParseFromMemory(const char *data, uint32_t size, | |||
| Status TensorFlowWeightsParser::Parse(const char *file, ge::Graph &graph) { return SUCCESS; } | |||
| Status TensorFlowModelParser::ParseProto(const google::protobuf::Message *proto, ge::ComputeGraphPtr &graph) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kParser); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kParser); | |||
| ErrorManager::GetInstance().GenWorkStreamIdDefault(); | |||
| PARSER_TIMESTAMP_START(ParseProto); | |||
| GE_CHECK_NOTNULL(proto); | |||
| @@ -2274,7 +2331,7 @@ Status TensorFlowModelParser::ParseProto(const google::protobuf::Message *proto, | |||
| Status TensorFlowModelParser::ParseProtoWithSubgraph(const google::protobuf::Message *root_proto, | |||
| domi::GetGraphCallback callback, ge::ComputeGraphPtr &root_graph) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kParser); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kParser); | |||
| ErrorManager::GetInstance().GenWorkStreamIdDefault(); | |||
| GE_CHECK_NOTNULL(root_proto); | |||
| GE_CHECK_NOTNULL(callback); | |||
| @@ -2292,6 +2349,7 @@ Status TensorFlowModelParser::ParseProtoWithSubgraph(const google::protobuf::Mes | |||
| if (arg.proto == nullptr) { | |||
| auto proto = callback(root_proto, arg.function_name); | |||
| if (proto == nullptr) { | |||
| REPORT_CALL_ERROR("E19999", "callback execute failed, func_name:%s", arg.function_name.c_str()); | |||
| GELOGE(FAILED, "Failed to get function by name %s", arg.function_name.c_str()); | |||
| return FAILED; | |||
| } | |||
| @@ -2328,12 +2386,20 @@ Status TensorFlowModelParser::ParseProtoWithSubgraph(const google::protobuf::Mes | |||
| Status TensorFlowModelParser::OptimizeIdentityByOutput(map<string, NodeDef *> &nodedef_map, | |||
| const string &curr_node_name, bool &clear_input_flag) { | |||
| auto context_iter = op_node_context_map_.find(curr_node_name); | |||
| GE_CHK_BOOL_TRUE_EXEC_WITH_LOG((context_iter == op_node_context_map_.end()), return INTERNAL_ERROR, | |||
| GE_CHK_BOOL_TRUE_EXEC_WITH_LOG((context_iter == op_node_context_map_.end()), | |||
| REPORT_INNER_ERROR("E19999", | |||
| "Node:%s can't find in op_node_context_map_, check invalid", | |||
| curr_node_name.c_str()); | |||
| return INTERNAL_ERROR, | |||
| "Can't find op node context."); | |||
| OpNodeContext op_node_context = context_iter->second; | |||
| auto node_def_iter = nodedef_map.find(curr_node_name); | |||
| GE_CHK_BOOL_TRUE_EXEC_WITH_LOG((node_def_iter == nodedef_map.end()), return INTERNAL_ERROR, "Can't find nodedef"); | |||
| GE_CHK_BOOL_TRUE_EXEC_WITH_LOG((node_def_iter == nodedef_map.end()), | |||
| REPORT_INNER_ERROR("E19999", | |||
| "Node:%s can't find in nodedef_map, check invalid", | |||
| curr_node_name.c_str()); | |||
| return INTERNAL_ERROR, "Can't find nodedef"); | |||
| domi::tensorflow::NodeDef *curr_node_def = node_def_iter->second; | |||
| GE_CHECK_NOTNULL(curr_node_def); | |||
| bool has_out_retval = false; | |||
| @@ -2398,12 +2464,17 @@ Status TensorFlowModelParser::OptimizeSnapShot(domi::tensorflow::NodeDef *curr_m | |||
| const std::vector<string> &control_list) { | |||
| GE_CHECK_NOTNULL(curr_mode_def); | |||
| if (curr_mode_def == nullptr) { | |||
| REPORT_INNER_ERROR("E19999", "Param curr_mode_def is nullptr, check invalid"); | |||
| GELOGE(FAILED, "input param is nullptr."); | |||
| return PARAM_INVALID; | |||
| } | |||
| string curr_node_name = curr_mode_def->name(); | |||
| auto context_iter = op_node_context_map_.find(curr_node_name); | |||
| GE_CHK_BOOL_TRUE_EXEC_WITH_LOG((context_iter == op_node_context_map_.end()), return INTERNAL_ERROR, | |||
| GE_CHK_BOOL_TRUE_EXEC_WITH_LOG((context_iter == op_node_context_map_.end()), | |||
| REPORT_INNER_ERROR("E19999", | |||
| "Node:%s can't find in op_node_context_map_, check invalid", | |||
| curr_node_name.c_str()); | |||
| return INTERNAL_ERROR, | |||
| "Can't find op node context."); | |||
| OpNodeContext op_node_context = context_iter->second; | |||
| @@ -2492,6 +2563,8 @@ Status TensorFlowModelParser::GraphDefOptimizeSnapShot(domi::tensorflow::GraphDe | |||
| } | |||
| } | |||
| if (data_input_cnt != 1) { | |||
| REPORT_INNER_ERROR("E19999", "Node:%s's input data size:%u not equal to 1, check invalid", | |||
| curr_node_def->name().c_str(), data_input_cnt); | |||
| GELOGE(FAILED, "%s op data input size %u invalid", curr_node_def->name().c_str(), data_input_cnt); | |||
| return FAILED; | |||
| } | |||
| @@ -2553,6 +2626,7 @@ void TensorFlowModelParser::OptimizeDestroyTemporaryVariable(domi::tensorflow::G | |||
| Status TensorFlowModelParser::GraphDefOptimizeDestroyTemporaryVariable(domi::tensorflow::GraphDef *graph_def, | |||
| domi::tensorflow::NodeDef *nodeCurrent) { | |||
| if (graph_def == nullptr || nodeCurrent == nullptr) { | |||
| REPORT_INNER_ERROR("E19999", "Param graph_def or nodeCurrent is nullptr, check invalid"); | |||
| GELOGE(FAILED, "input param is nullptr."); | |||
| return FAILED; | |||
| } | |||
| @@ -2586,6 +2660,8 @@ Status TensorFlowModelParser::GraphDefOptimizeDestroyTemporaryVariable(domi::ten | |||
| } | |||
| } | |||
| if (!clearInputFlag) { | |||
| REPORT_INNER_ERROR("E19999", "Optimize DestroyTemporaryVariable failed, node name is :%s.", | |||
| nodeCurrent->name().c_str()); | |||
| GELOGE(INTERNAL_ERROR, "Optimize DestroyTemporaryVariable failed, node name is :%s.", nodeCurrent->name().c_str()); | |||
| return FAILED; | |||
| } | |||
| @@ -3084,12 +3160,17 @@ Status TensorFlowModelParser::FusionNodeParseParams(shared_ptr<OpParser> &op_par | |||
| shared_ptr<TensorFlowFusionOpParser> tensorflow_fusion_op_parser = | |||
| std::dynamic_pointer_cast<TensorFlowFusionOpParser>(op_parser); | |||
| GE_IF_BOOL_EXEC(tensorflow_fusion_op_parser == nullptr, | |||
| REPORT_INNER_ERROR("E19999", "Param op_parser is not TensorFlowFusionOpParser Type, check invalid"); | |||
| GELOGE(FAILED, "node :%s can not get fusion parser, please check!", node_def->name().c_str()); | |||
| return INTERNAL_ERROR); | |||
| // Find all children of the fusion operator | |||
| auto iter = fusion_op_nodedef_map_.find(node_def->name()); | |||
| GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(iter == fusion_op_nodedef_map_.end(), return INTERNAL_ERROR, | |||
| GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(iter == fusion_op_nodedef_map_.end(), | |||
| REPORT_INNER_ERROR("E19999", | |||
| "Node:%s can't find in fusion_op_nodedef_map_, check invalid", | |||
| node_def->name().c_str()); | |||
| return INTERNAL_ERROR, | |||
| "FusionOp node %s has no children node!", node_def->name().c_str()); | |||
| (void)ge::AttrUtils::SetStr(node->GetOpDesc(), ge::ATTR_NAME_FUSIONOP_ORIGINAL_TYPE, node_def->op()); | |||
| @@ -3106,6 +3187,8 @@ Status TensorFlowModelParser::FusionNodeParseParams(shared_ptr<OpParser> &op_par | |||
| ge::Operator op_src(node_def_src->name(), node_def_src->op()); | |||
| status = domi::AutoMappingFn(node_def_src, op_src); | |||
| if (status != SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Auto mapping node_def:%s(%s) to operator failed", | |||
| node_def_src->name().c_str(), node_def_src->op().c_str()); | |||
| GELOGE(status, "Node[%s] auto mapping failed", node_def_src->name().c_str()); | |||
| return status; | |||
| } | |||
| @@ -3115,6 +3198,8 @@ Status TensorFlowModelParser::FusionNodeParseParams(shared_ptr<OpParser> &op_par | |||
| ge::GeTensorDesc tensor_desc; | |||
| tensor_desc.SetName(node_def_src->input(i)); | |||
| if (op_desc->AddInputDesc(tensor_desc) != GRAPH_SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Add input desc to op:%s(%s) failed", | |||
| op_desc->GetName().c_str(), op_desc->GetType().c_str()); | |||
| GELOGE(FAILED, "Op [%s] type[%s] add input(%d) tensor failed.", op_desc->GetName().c_str(), | |||
| op_desc->GetType().c_str(), i); | |||
| return FAILED; | |||
| @@ -3208,6 +3293,9 @@ Status TensorFlowModelParser::OptimizeConstNodes4CustomOp(domi::tensorflow::Grap | |||
| } else if (it.moveType == domi::OMG_INPUT_REORDER) { | |||
| auto inputs = current_node->input(); | |||
| if (static_cast<size_t>(inputs.size()) != it.input_order.size()) { | |||
| REPORT_INNER_ERROR("E19999", "Input size of node:%s(%s) is mismatched, new order size:%zu, input size:%d", | |||
| current_node->name().c_str(), current_node->op().c_str(), | |||
| it.input_order.size(), inputs.size()); | |||
| GELOGE(INTERNAL_ERROR, "Size of input is mismatched, new order size is %zu, input size is %d.", | |||
| it.input_order.size(), inputs.size()); | |||
| return INTERNAL_ERROR; | |||
| @@ -3215,6 +3303,8 @@ Status TensorFlowModelParser::OptimizeConstNodes4CustomOp(domi::tensorflow::Grap | |||
| for (size_t i = 0; i < it.input_order.size(); ++i) { | |||
| int new_index = it.input_order[i]; | |||
| if (new_index < 0 || new_index >= inputs.size()) { | |||
| REPORT_INNER_ERROR("E19999", "New order of %s has invalid index %d, out of range(0, %d)", | |||
| it_node_map.first.c_str(), new_index, inputs.size()); | |||
| GELOGE(INTERNAL_ERROR, "New order of %s has invalid index %d.", it_node_map.first.c_str(), new_index); | |||
| return INTERNAL_ERROR; | |||
| } | |||
| @@ -3246,6 +3336,7 @@ Status TensorFlowModelParser::AddControlEdgeAfterRemoveInputs(domi::tensorflow:: | |||
| string input_node_name = NodeNameFromInput(remove_input); | |||
| auto it = all_node_map.find(input_node_name); | |||
| if (it == all_node_map.end()) { | |||
| REPORT_INNER_ERROR("E19999", "Node:%s can't find in all_node_map, check invalid", input_node_name.c_str()); | |||
| GELOGE(FAILED, "Can not find node name:%s in all node map.", input_node_name.c_str()); | |||
| return FAILED; | |||
| } | |||
| @@ -3391,6 +3482,7 @@ Status TensorFlowModelParser::RemoveIsolateNode(domi::tensorflow::GraphDef *grap | |||
| domi::tensorflow::NodeDef *node = graph_def->mutable_node(i); | |||
| const string &node_name = node->name(); | |||
| if (node_inputs_outputs_map_.find(node_name) == node_inputs_outputs_map_.end()) { | |||
| REPORT_INNER_ERROR("E19999", "Node:%s can't find in node_inputs_outputs_map_, check invalid", node_name.c_str()); | |||
| GELOGE(FAILED, "Can not find input output context, node:%s.", node_name.c_str()); | |||
| return FAILED; | |||
| } | |||
| @@ -3445,6 +3537,9 @@ Status TensorFlowModelParser::RecordFusionResult(std::shared_ptr<ge::ScopeGraph> | |||
| } | |||
| if (fusion_output.second[i] >= static_cast<int32_t>(op_desc->GetOutputsSize())) { | |||
| REPORT_INNER_ERROR("E19999", "fusion output index:%d of node:%s(%s) must less than outputs desc size %zu.", | |||
| fusion_output.second[i], op_desc->GetName().c_str(), op_desc->GetType().c_str(), | |||
| op_desc->GetOutputsSize()); | |||
| GELOGE(PARAM_INVALID, "fusion output index %d must less than outputs desc size %zu.", fusion_output.second[i], | |||
| op_desc->GetOutputsSize()); | |||
| return PARAM_INVALID; | |||
| @@ -3626,6 +3721,7 @@ Status TensorFlowModelParser::UpdateInnerNodeContext(const string &fusion_op_nam | |||
| const std::vector<std::string> &inner_nodes_name) { | |||
| auto fusion_iter = op_node_context_map_.find(fusion_op_name); | |||
| if (fusion_iter == op_node_context_map_.end()) { | |||
| REPORT_INNER_ERROR("E19999", "Node:%s can't find in op_node_context_map_, check invalid", fusion_op_name.c_str()); | |||
| GELOGE(INTERNAL_ERROR, "Can't find context for fusion node %s.", fusion_op_name.c_str()); | |||
| return INTERNAL_ERROR; | |||
| } | |||
| @@ -3752,6 +3848,7 @@ Status TensorFlowModelParser::AddScopeInnerNode(TensorFlowModelParser *parser, g | |||
| string node_op = node_def->op(); | |||
| auto iter = parser->scope_inner_node_map_.find(node_name); | |||
| if (iter == parser->scope_inner_node_map_.end()) { | |||
| REPORT_INNER_ERROR("E19999", "Node:%s can't find in scope_inner_node_map_, check invalid", node_name.c_str()); | |||
| GELOGE(PARAM_INVALID, "Failed to find scope inner node:%s, type:%s.", node_name.c_str(), node_op.c_str()); | |||
| return PARAM_INVALID; | |||
| } | |||
| @@ -3764,6 +3861,8 @@ Status TensorFlowModelParser::AddScopeInnerNode(TensorFlowModelParser *parser, g | |||
| node = graph->AddNode(op_desc); | |||
| } | |||
| if (node == nullptr) { | |||
| REPORT_CALL_ERROR("E19999", "Add node:%s(%s) to graph:%s failed", | |||
| op_desc->GetName().c_str(), op_desc->GetType().c_str(), graph->GetName().c_str()); | |||
| GELOGE(INTERNAL_ERROR, "Failed to Add scope inner node:%s, type:%s.", op_desc->GetName().c_str(), | |||
| op_desc->GetType().c_str()); | |||
| return INTERNAL_ERROR; | |||
| @@ -3817,6 +3916,8 @@ Status TensorFlowModelParser::CheckAndUpdateInputDesc(ge::ComputeGraphPtr &compu | |||
| ge::GeTensorDesc tensor_desc; | |||
| auto ret = op_desc->UpdateInputDesc(static_cast<uint32_t>(in_anchor->GetIdx()), tensor_desc); | |||
| if (ret != ge::GRAPH_SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Update index:%d of input desc in op:%s(%s) failed", in_anchor->GetIdx(), | |||
| op_desc->GetName().c_str(), op_desc->GetType().c_str()); | |||
| GELOGE(ret, "Failed to update input desc, node:%s, index:%d.", node->GetName().c_str(), in_anchor->GetIdx()); | |||
| return ret; | |||
| } | |||
| @@ -3826,6 +3927,8 @@ Status TensorFlowModelParser::CheckAndUpdateInputDesc(ge::ComputeGraphPtr &compu | |||
| ge::GeTensorDesc tensor_desc(ge::GeShape(), FORMAT_RESERVED, DT_UNDEFINED); | |||
| auto ret = op_desc->UpdateInputDesc(static_cast<uint32_t>(in_anchor->GetIdx()), tensor_desc); | |||
| if (ret != ge::GRAPH_SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Update index:%d of input desc in op:%s(%s) failed", in_anchor->GetIdx(), | |||
| op_desc->GetName().c_str(), op_desc->GetType().c_str()); | |||
| GELOGE(ret, "Failed to update input desc, node:%s, index:%d.", node->GetName().c_str(), in_anchor->GetIdx()); | |||
| return ret; | |||
| } | |||
| @@ -565,7 +565,8 @@ class PARSER_FUNC_VISIBILITY TensorFlowModelParser : public domi::ModelParser { | |||
| * | |||
| */ | |||
| static Status ParseNodeDef(TensorFlowModelParser *parser, ge::ComputeGraphPtr &graph, std::mutex *graphMutex, | |||
| shared_ptr<ge::ScopeGraph> &scope_graph, const domi::tensorflow::NodeDef *node_def); | |||
| shared_ptr<ge::ScopeGraph> &scope_graph, const domi::tensorflow::NodeDef *node_def, | |||
| error_message::Context error_context); | |||
| /** | |||
| * @ingroup domi_omg | |||
| @@ -42,8 +42,12 @@ Status TensorFlowRefSwitchParser::ParseT(const domi::tensorflow::NodeDef *node, | |||
| domi::tensorflow::DataType tfType = attr.type(); | |||
| ge::DataType type = domi::TensorAssign::ConvertTensorflowDataType(tfType); | |||
| CHECK_FALSE_EXEC(type != ge::DataType::DT_UNDEFINED, GELOGE(FAILED, "Data type %s of node %s is not supported.", | |||
| DataType_Name(tfType).c_str(), node->name().c_str()); | |||
| CHECK_FALSE_EXEC(type != ge::DataType::DT_UNDEFINED, | |||
| REPORT_CALL_ERROR("E19999", "Data type %s of node %s is not supported", | |||
| DataType_Name(tfType).c_str(), | |||
| node->name().c_str()); | |||
| GELOGE(FAILED, "Data type %s of node %s is not supported.", | |||
| DataType_Name(tfType).c_str(), node->name().c_str()); | |||
| return PARAM_INVALID); | |||
| op->T(type); | |||
| @@ -38,8 +38,11 @@ Status TensorFlowReshapeParser::ParseDesc(const domi::tensorflow::AttrValue &att | |||
| auto data_type = ge_desc.GetDataType(); | |||
| bool type_ret = ge::TypeUtils::GetDataTypeLength(data_type, size_type); | |||
| GE_IF_BOOL_EXEC(!type_ret, GELOGE(FAILED, "Can't GetDataTypeLength of data_type: %s", | |||
| ge::TypeUtils::DataTypeToSerialString(data_type).c_str()); | |||
| GE_IF_BOOL_EXEC(!type_ret, | |||
| REPORT_CALL_ERROR("E19999", "Data type %s is not supported", | |||
| ge::TypeUtils::DataTypeToSerialString(data_type).c_str()); | |||
| GELOGE(FAILED, "Can't GetDataTypeLength of data_type: %s", | |||
| ge::TypeUtils::DataTypeToSerialString(data_type).c_str()); | |||
| return PARAM_INVALID); | |||
| // calculate size | |||
| for (uint32_t j = 0; j < ge_desc.GetShape().GetDimNum(); ++j) { | |||
| @@ -44,8 +44,11 @@ Status TensorFlowShapeNParser::ParseInType(const domi::tensorflow::NodeDef *node | |||
| domi::tensorflow::DataType tf_type = attr.type(); | |||
| ge::DataType type = domi::TensorAssign::ConvertTensorflowDataType(tf_type); | |||
| CHECK_FALSE_EXEC(type != ge::DataType::DT_UNDEFINED, GELOGE(FAILED, "Data type %s of node %s is not supported.", | |||
| DataType_Name(tf_type).c_str(), node->name().c_str()); | |||
| CHECK_FALSE_EXEC(type != ge::DataType::DT_UNDEFINED, | |||
| REPORT_CALL_ERROR("E19999", "Data type %s of node %s is not supported", | |||
| DataType_Name(tf_type).c_str(), node->name().c_str()); | |||
| GELOGE(FAILED, "Data type %s of node %s is not supported.", | |||
| DataType_Name(tf_type).c_str(), node->name().c_str()); | |||
| return PARAM_INVALID); | |||
| op->InType(type); | |||
| @@ -64,8 +67,11 @@ Status TensorFlowShapeNParser::ParseOutType(const domi::tensorflow::NodeDef *nod | |||
| domi::tensorflow::DataType tf_type = attr.type(); | |||
| ge::DataType type = domi::TensorAssign::ConvertTensorflowDataType(tf_type); | |||
| CHECK_FALSE_EXEC(type != ge::DataType::DT_UNDEFINED, GELOGE(FAILED, "Data type %s of node %s is not supported.", | |||
| DataType_Name(tf_type).c_str(), node->name().c_str()); | |||
| CHECK_FALSE_EXEC(type != ge::DataType::DT_UNDEFINED, | |||
| REPORT_CALL_ERROR("E19999", "Data type %s of node %s is not supported", | |||
| DataType_Name(tf_type).c_str(), node->name().c_str()); | |||
| GELOGE(FAILED, "Data type %s of node %s is not supported.", | |||
| DataType_Name(tf_type).c_str(), node->name().c_str()); | |||
| return PARAM_INVALID); | |||
| op->OutType(type); | |||
| @@ -106,6 +112,8 @@ Status TensorFlowShapeNParser::ParseParams(const Message *op_src, ge::OpDescPtr | |||
| // add dynamic input/output | |||
| domi::tensorflow::AttrValue attr_num; | |||
| CHECK_FALSE_EXEC(TensorFlowUtil::FindAttrValue(node, SHAPEN_ATTR_N, attr_num), | |||
| REPORT_CALL_ERROR("E19999", "In NodeDef:%s attr:%s not exist, check invalid", | |||
| node->name().c_str(), SHAPEN_ATTR_N.c_str()); | |||
| GELOGE(FAILED, "Get Attr N failed in Node %s.", node->name().c_str()); | |||
| return PARAM_INVALID); | |||
| int32_t dynamic_tensor_num = attr_num.i(); | |||
| @@ -127,12 +135,16 @@ Status TensorFlowShapeNParser::ParseParams(const Message *op_src, ge::OpDescPtr | |||
| } | |||
| graphStatus status = op_dest->AddDynamicOutputDesc("y", dynamic_tensor_num); | |||
| if (status != GRAPH_SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Add Dynamic OuputDesc name:y to node:%s(%s) failed", | |||
| op_dest->GetName().c_str(), op_dest->GetType().c_str()); | |||
| GELOGE(FAILED, "Add dynamic output:y for node:%s failed.", op_dest->GetName().c_str()); | |||
| return FAILED; | |||
| } | |||
| } | |||
| graphStatus status = op_dest->AddDynamicInputDesc("x", dynamic_tensor_num); | |||
| if (status != GRAPH_SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Add Dynamic InputDesc name:x to node:%s(%s) failed", | |||
| op_dest->GetName().c_str(), op_dest->GetType().c_str()); | |||
| GELOGE(FAILED, "Add dynamic input:x for node:%s failed.", op_dest->GetName().c_str()); | |||
| return FAILED; | |||
| } | |||
| @@ -42,8 +42,11 @@ Status TensorFlowSqueezeParser::ParseDesc(const domi::tensorflow::AttrValue &att | |||
| auto data_type = ge_desc.GetDataType(); | |||
| bool type_ret = ge::TypeUtils::GetDataTypeLength(data_type, size_type); | |||
| GE_IF_BOOL_EXEC(!type_ret, GELOGE(domi::PARAM_INVALID, "Can't GetDataTypeLength of data_type: %s", | |||
| GE_IF_BOOL_EXEC(!type_ret, | |||
| REPORT_CALL_ERROR("E19999", "Data type %s is not supported", | |||
| ge::TypeUtils::DataTypeToSerialString(data_type).c_str()); | |||
| GELOGE(domi::PARAM_INVALID, "Can't GetDataTypeLength of data_type: %s", | |||
| ge::TypeUtils::DataTypeToSerialString(data_type).c_str()); | |||
| return domi::PARAM_INVALID); | |||
| // calculate size | |||
| for (uint32_t j = 0; j < ge_desc.GetShape().GetDimNum(); ++j) { | |||
| @@ -83,6 +86,8 @@ Status TensorFlowSqueezeParser::ParseParams(const Message *op_src, ge::OpDescPtr | |||
| return SUCCESS; | |||
| } | |||
| if (has_axis && has_dims) { | |||
| REPORT_CALL_ERROR("E19999", "In NodeDef %s, Attr %s or %s not exist, check invalid", node->name().c_str(), | |||
| SQUEEZE_ATTR_AXIS.c_str(), SQUEEZE_ATTR_DIMS.c_str()); | |||
| GELOGE(FAILED, "In NodeDef %s dim and axis is error.", node->name().c_str()); | |||
| return domi::PARAM_INVALID; | |||
| } | |||
| @@ -101,6 +106,8 @@ Status TensorFlowSqueezeParser::ParseParams(const Message *op_src, ge::OpDescPtr | |||
| v_result.push_back(result); | |||
| } | |||
| if (!ge::AttrUtils::SetListInt(op, SQUEEZE_ATTR_AXIS, v_result)) { | |||
| REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", SQUEEZE_ATTR_AXIS.c_str(), | |||
| op->GetName().c_str(), op->GetType().c_str()); | |||
| GELOGE(FAILED, "Set squeeze axis attr failed"); | |||
| return FAILED; | |||
| } | |||
| @@ -121,9 +128,13 @@ Status TensorFlowSqueezeParser::ParseParams(const Message *op_src, ge::OpDescPtr | |||
| } | |||
| if (!ge::AttrUtils::SetTensorDesc(op, RESHAPE_ATTR_NAME_INPUT_DESC, input_desc)) { | |||
| REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", RESHAPE_ATTR_NAME_INPUT_DESC.c_str(), | |||
| op->GetName().c_str(), op->GetType().c_str()); | |||
| GELOGE(FAILED, "Set input desc failed"); | |||
| return FAILED; | |||
| } if (!ge::AttrUtils::SetTensorDesc(op, RESHAPE_ATTR_NAME_OUTPUT_DESC, output_desc)) { | |||
| REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", RESHAPE_ATTR_NAME_OUTPUT_DESC.c_str(), | |||
| op->GetName().c_str(), op->GetType().c_str()); | |||
| GELOGE(FAILED, "Set output desc failed"); | |||
| return FAILED; | |||
| }) | |||
| @@ -87,6 +87,8 @@ static Status ParseSrcType(const domi::tensorflow::NodeDef *node, VariableOperat | |||
| // The upper caller guarantees input params is not empty. | |||
| domi::tensorflow::AttrValue attr; | |||
| CHECK_FALSE_EXEC(TensorFlowUtil::FindAttrValue(node, VAR_ATTR_DTYPE, attr), | |||
| REPORT_CALL_ERROR("E19999", "In NodeDef:%s attr:%s not exist, check invalid", | |||
| node->name().c_str(), VAR_ATTR_DTYPE.c_str()); | |||
| GELOGE(FAILED, "Attr %s does not exist in NodeDef %s.", | |||
| VAR_ATTR_DTYPE.c_str(), node->name().c_str()); | |||
| return PARAM_INVALID); | |||
| @@ -97,8 +99,11 @@ static Status ParseSrcType(const domi::tensorflow::NodeDef *node, VariableOperat | |||
| domi::tensorflow::DataType tf_type = attr.type(); | |||
| ge::DataType type = domi::TensorAssign::ConvertTensorflowDataType(tf_type); | |||
| CHECK_FALSE_EXEC(type != ge::DataType::DT_UNDEFINED, GELOGE(FAILED, "Data type %s of node %s is not supported.", | |||
| DataType_Name(tf_type).c_str(), node->name().c_str()); | |||
| CHECK_FALSE_EXEC(type != ge::DataType::DT_UNDEFINED, | |||
| REPORT_CALL_ERROR("E19999", "Data type %s of node %s is not supported", | |||
| DataType_Name(tf_type).c_str(), node->name().c_str()); | |||
| GELOGE(FAILED, "Data type %s of node %s is not supported.", | |||
| DataType_Name(tf_type).c_str(), node->name().c_str()); | |||
| return PARAM_INVALID); | |||
| op->SrcType(type); | |||
| @@ -109,6 +114,8 @@ Status ParseContainer(const domi::tensorflow::NodeDef *node, VariableOperator *o | |||
| // The upper caller guarantees input params is not empty. | |||
| domi::tensorflow::AttrValue attr; | |||
| CHECK_FALSE_EXEC(TensorFlowUtil::FindAttrValue(node, VAR_ATTR_CONTAINER, attr), | |||
| REPORT_CALL_ERROR("E19999", "In NodeDef:%s attr:%s not exist, check invalid", | |||
| node->name().c_str(), VAR_ATTR_CONTAINER.c_str()); | |||
| GELOGE(FAILED, "Attr %s does not exist in NodeDef %s.", | |||
| VAR_ATTR_CONTAINER.c_str(), node->name().c_str()); | |||
| return PARAM_INVALID); | |||
| @@ -126,6 +133,8 @@ Status ParseSharedName(const domi::tensorflow::NodeDef *node, VariableOperator * | |||
| domi::tensorflow::AttrValue attr; | |||
| CHECK_FALSE_EXEC( | |||
| TensorFlowUtil::FindAttrValue(node, VAR_ATTR_SHARED_NAME, attr), | |||
| REPORT_CALL_ERROR("E19999", "In NodeDef:%s attr:%s not exist, check invalid", | |||
| node->name().c_str(), VAR_ATTR_SHARED_NAME.c_str()); | |||
| GELOGE(FAILED, "Attr %s does not exist in NodeDef %s.", VAR_ATTR_SHARED_NAME.c_str(), node->name().c_str()); | |||
| return PARAM_INVALID); | |||
| GE_RETURN_WITH_LOG_IF_ERROR(TensorFlowUtil::CheckAttrHasType(attr, TENSORFLOW_ATTR_TYPE_STRING), | |||
| @@ -141,6 +150,8 @@ static Status ParseVarName(const domi::tensorflow::NodeDef *node, VariableOperat | |||
| // The upper caller guarantees input params is not empty. | |||
| domi::tensorflow::AttrValue attr; | |||
| CHECK_FALSE_EXEC(TensorFlowUtil::FindAttrValue(node, ge::VAR_ATTR_NAME, attr), | |||
| REPORT_CALL_ERROR("E19999", "In NodeDef:%s attr:%s not exist, check invalid", | |||
| node->name().c_str(), VAR_ATTR_NAME.c_str()); | |||
| GELOGE(FAILED, "Attr %s does not exist in NodeDef %s.", ge::VAR_ATTR_NAME.c_str(), | |||
| node->name().c_str()); return PARAM_INVALID); | |||
| @@ -174,6 +185,8 @@ static Status ParseVarShape(const domi::tensorflow::NodeDef *node, VariableOpera | |||
| domi::tensorflow::AttrValue attr_value; | |||
| if (!TensorFlowUtil::FindAttrValue(node, ge::ATTR_NAME_OUTPUT_TENSOR_DESC, attr_value)) { | |||
| REPORT_CALL_ERROR("E19999", "In NodeDef:%s attr:%s not exist, check invalid", | |||
| node->name().c_str(), ATTR_NAME_OUTPUT_TENSOR_DESC.c_str()); | |||
| GELOGE(FAILED, "In NodeDef %s Attr %s is not exist.", node_src_name.c_str(), | |||
| ge::ATTR_NAME_OUTPUT_TENSOR_DESC.c_str()); | |||
| return FAILED; | |||
| @@ -188,6 +201,8 @@ static Status ParseVarShape(const domi::tensorflow::NodeDef *node, VariableOpera | |||
| ge::Format src_format = ge::FORMAT_ND; | |||
| CHECK_FALSE_EXEC(TensorFlowUtil::FindAttrValue(node, VAR_ATTR_SHAPE, attr_value), | |||
| REPORT_CALL_ERROR("E19999", "In NodeDef:%s attr:%s not exist, check invalid", | |||
| node->name().c_str(), VAR_ATTR_SHAPE.c_str()); | |||
| GELOGE(FAILED, "Attr %s does not exist in NodeDef %s.", VAR_ATTR_SHAPE.c_str(), | |||
| node->name().c_str()); return PARAM_INVALID); | |||
| @@ -74,7 +74,7 @@ int ErrorManager::OutputMessage(int handle) { return 0; } | |||
| /// @param [in] value: vector parameter value | |||
| /// | |||
| void ErrorManager::ATCReportErrMessage(std::string error_code, const std::vector<std::string> &key, | |||
| const std::vector<std::string> &value) { | |||
| const std::vector<std::string> &value) { | |||
| } | |||
| /// | |||
| @@ -97,5 +97,12 @@ int ErrorManager::GetMstuneCompileFailedMsg(const std::string &graph_name, std:: | |||
| void ErrorManager::SetStage(const std::string &first_stage, const std::string &second_stage) { | |||
| } | |||
| struct error_message::Context &ErrorManager::GetErrorManagerContext() { | |||
| struct error_message::Context error_context; | |||
| return error_context; | |||
| } | |||
| void ErrorManager::SetErrorContext(struct error_message::Context error_context) {} | |||
| void ErrorManager::GenWorkStreamIdDefault() { | |||
| } | |||
| } | |||
| @@ -290,6 +290,7 @@ include_directories(${CMAKE_BINARY_DIR}/proto/ge) | |||
| include_directories(${PARSER_DIR}) | |||
| include_directories(${PARSER_DIR}/inc) | |||
| include_directories(${PARSER_DIR}/parser) | |||
| include_directories(${PARSER_DIR}/parser/onnx) | |||
| include_directories(${PARSER_DIR}/metadef/inc) | |||
| include_directories(${PARSER_DIR}/metadef/inc/external) | |||
| include_directories(${PARSER_DIR}/metadef/inc/register) | |||