From fba6cb5a256ebc0b150701d41d9724149188b3b8 Mon Sep 17 00:00:00 2001 From: wangzhengjun Date: Fri, 30 Oct 2020 11:45:30 +0800 Subject: [PATCH 1/5] update input desc --- parser/tensorflow/tensorflow_parser.cc | 37 ++++++++++++++++++++++++++ parser/tensorflow/tensorflow_parser.h | 1 + 2 files changed, 38 insertions(+) diff --git a/parser/tensorflow/tensorflow_parser.cc b/parser/tensorflow/tensorflow_parser.cc index a486462..cdf727e 100644 --- a/parser/tensorflow/tensorflow_parser.cc +++ b/parser/tensorflow/tensorflow_parser.cc @@ -1397,6 +1397,7 @@ Status TensorFlowModelParser::ParseAllGraph(const google::protobuf::Message *pro GE_RETURN_IF_ERROR(AddEdges(graph)); GE_RETURN_IF_ERROR(RemoveIsolateNode(graph)); + GE_RETURN_IF_ERROR(CheckAndUpdateInputDesc(graph)); GE_RETURN_IF_ERROR(graph->TopologicalSorting()); if (has_error) { @@ -2196,6 +2197,7 @@ Status TensorFlowModelParser::ParseProto(const google::protobuf::Message *proto, PARSER_TIMESTAMP_START(RemoveIsolateNode); // Delete isolated nodes GE_RETURN_IF_ERROR(RemoveIsolateNode(graph)); + GE_RETURN_IF_ERROR(CheckAndUpdateInputDesc(graph)); PARSER_TIMESTAMP_END(RemoveIsolateNode, "TensorFlowModelParser::RemoveIsolateNode"); PARSER_TIMESTAMP_START(TopologicalSorting); @@ -3714,6 +3716,41 @@ void TensorFlowModelParser::DumpAllNodeContext(const string &phase) { DumpNodeContext(iter.first, iter.second, phase); } } + +Status TensorFlowModelParser::CheckAndUpdateInputDesc(ge::ComputeGraphPtr &compute_graph) { + GE_CHECK_NOTNULL(compute_graph); + for (auto &node : compute_graph->GetDirectNode()) { + auto op_desc = node->GetOpDesc(); + GE_CHECK_NOTNULL(op_desc); + for (auto &in_anchor : node->GetAllInDataAnchors()) { + if (!(op_desc->IsOptionalInput(static_cast(in_anchor->GetIdx())))) { + continue; + } + auto peer_out_anchor = in_anchor->GetPeerOutAnchor(); + auto in_desc = op_desc->MutableInputDesc(static_cast(in_anchor->GetIdx())); + if ((peer_out_anchor != nullptr) && (in_desc == nullptr)) { + // The input is connected to the peer output but TensorDesc is invalid, update TensorDesc to valid. + ge::GeTensorDesc tensor_desc; + auto ret = op_desc->UpdateInputDesc(static_cast(in_anchor->GetIdx()), tensor_desc); + if (ret != ge::GRAPH_SUCCESS) { + GELOGE(ret, "Failed to update input desc, node:%s, index:%d.", node->GetName().c_str(), in_anchor->GetIdx()); + return ret; + } + GELOGI("Update input desc to valid, node:%s, index:%d.", node->GetName().c_str(), in_anchor->GetIdx()); + } else if ((peer_out_anchor == nullptr) && (in_desc != nullptr)) { + // The input is not connected to the peer output but TensorDesc is valid, update TensorDesc to invalid. + ge::GeTensorDesc tensor_desc(ge::GeShape(), FORMAT_RESERVED, DT_UNDEFINED); + auto ret = op_desc->UpdateInputDesc(static_cast(in_anchor->GetIdx()), tensor_desc); + if (ret != ge::GRAPH_SUCCESS) { + GELOGE(ret, "Failed to update input desc, node:%s, index:%d.", node->GetName().c_str(), in_anchor->GetIdx()); + return ret; + } + GELOGI("Update input desc to invalid, node:%s, index:%d.", node->GetName().c_str(), in_anchor->GetIdx()); + } + } + } + return SUCCESS; +} } // namespace ge namespace domi { diff --git a/parser/tensorflow/tensorflow_parser.h b/parser/tensorflow/tensorflow_parser.h index ac313fc..2200a8d 100644 --- a/parser/tensorflow/tensorflow_parser.h +++ b/parser/tensorflow/tensorflow_parser.h @@ -603,6 +603,7 @@ class TensorFlowModelParser : public domi::ModelParser { void DumpAllNodeContext(const string &phase); Status ParseOpParams(const domi::tensorflow::NodeDef *node_def, ge::OpDescPtr &op, shared_ptr &op_parser); + Status CheckAndUpdateInputDesc(ge::ComputeGraphPtr &compute_graph); /** * save From 95ace8eb899bec01d217508fe966355856f1c002 Mon Sep 17 00:00:00 2001 From: zhengyuanhua Date: Mon, 2 Nov 2020 11:05:56 +0800 Subject: [PATCH 2/5] dts: aipp error message report --- parser/caffe/caffe_parser.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/parser/caffe/caffe_parser.cc b/parser/caffe/caffe_parser.cc index 4b3b2a7..4088a4c 100644 --- a/parser/caffe/caffe_parser.cc +++ b/parser/caffe/caffe_parser.cc @@ -1543,6 +1543,7 @@ void CaffeModelParser::SaveOrigionLayerTops(domi::caffe::LayerParameter &layer) Status CaffeModelParser::SaveDataLayerTops(const domi::caffe::LayerParameter &layer) { string name = layer.name(); if (node_map.find(name) == node_map.end()) { + ErrorManager::GetInstance().ATCReportErrMessage("E11034", {"opname"}, {name}); GELOGE(FAILED, "Node can not be found by layer name: %s", name.c_str()); return FAILED; } @@ -1552,6 +1553,8 @@ Status CaffeModelParser::SaveDataLayerTops(const domi::caffe::LayerParameter &la if (node->GetType() == ge::parser::DATA) { if (layer.top_size() != 1) { + ErrorManager::GetInstance().ATCReportErrMessage("E11035", {"opname", "size"}, + {name, std::to_string(layer.top_size())}); GELOGE(FAILED, "Data layer[%s] top size must be 1, real size: %d", name.c_str(), layer.top_size()); return FAILED; } @@ -1559,7 +1562,8 @@ Status CaffeModelParser::SaveDataLayerTops(const domi::caffe::LayerParameter &la string top_name = layer.top(0); auto data_top_names = ge::GetParserContext().data_top_names; if (find(data_top_names.begin(), data_top_names.end(), top_name) != data_top_names.end()) { - GELOGE(FAILED, "Different data can not have same top name: %s.", top_name.c_str()); + ErrorManager::GetInstance().ATCReportErrMessage("E11036", {"topname"}, {top_name}); + GELOGE(FAILED, "Different data node can not have same top name: %s.", top_name.c_str()); return FAILED; } ge::GetParserContext().data_top_names.push_back(top_name); From edc18bae389806364c19f5113484002b39e4bb9f Mon Sep 17 00:00:00 2001 From: t00456437 Date: Wed, 4 Nov 2020 11:15:42 +0800 Subject: [PATCH 3/5] solve compile definition --- metadef | 2 +- parser/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/metadef b/metadef index bf012e6..78457c5 160000 --- a/metadef +++ b/metadef @@ -1 +1 @@ -Subproject commit bf012e65ec60b40d18936677547c94bbd1f89323 +Subproject commit 78457c578f70fb8eb6c239d221cfd3e66f89cb12 diff --git a/parser/CMakeLists.txt b/parser/CMakeLists.txt index db446e1..59cdb65 100644 --- a/parser/CMakeLists.txt +++ b/parser/CMakeLists.txt @@ -131,7 +131,7 @@ target_compile_options(fmk_parser_stub PRIVATE ) target_compile_definitions(fmk_parser_stub PRIVATE - $<$:FMK_SUPPORT_DUMP> + $<$,$>:FMK_SUPPORT_DUMP> PROTOBUF_INLINE_NOT_IN_HEADERS=0 REUSE_MEMORY=1 FMK_HOST_INFER From 17fcc4b977deb06d0de7534d3fe3043bdb667ea3 Mon Sep 17 00:00:00 2001 From: taoxiangdong Date: Wed, 4 Nov 2020 14:12:35 +0800 Subject: [PATCH 4/5] update submodule metadef --- metadef | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadef b/metadef index 78457c5..c3543bc 160000 --- a/metadef +++ b/metadef @@ -1 +1 @@ -Subproject commit 78457c578f70fb8eb6c239d221cfd3e66f89cb12 +Subproject commit c3543bc707bdfd60ef4f52b6dffcdfefdf3b8329 From f54e46e5643f264a33261f124bb3552bb2ecac6d Mon Sep 17 00:00:00 2001 From: wangzhengjun Date: Thu, 5 Nov 2020 14:44:53 +0800 Subject: [PATCH 5/5] update submodule metadef --- metadef | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadef b/metadef index c3543bc..d08620f 160000 --- a/metadef +++ b/metadef @@ -1 +1 @@ -Subproject commit c3543bc707bdfd60ef4f52b6dffcdfefdf3b8329 +Subproject commit d08620f627a7fb8087271c2dea0677f8a00b96d4