Browse Source

!481 sync ge_dev to master 20220314

Merge pull request !481 from 张盛杰/ge_dev
pull/482/MERGE
计晨 Gitee 3 years ago
parent
commit
dc179e647b
No known key found for this signature in database GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 9 additions and 6 deletions
  1. +8
    -5
      parser/onnx/subgraph_adapter/if_subgraph_adapter.cc
  2. +1
    -1
      parser/tensorflow/tensorflow_parser.cc

+ 8
- 5
parser/onnx/subgraph_adapter/if_subgraph_adapter.cc View File

@@ -14,6 +14,7 @@
* limitations under the License.
*/

#include <unordered_set>
#include "if_subgraph_adapter.h"
#include "subgraph_adapter_factory.h"
#include "common/util.h"
@@ -95,8 +96,8 @@ domi::Status IfSubgraphAdapter::ParseIfNodeSubgraphs(

domi::Status IfSubgraphAdapter::GetSubgraphsAllInputs(ge::onnx::GraphProto &onnx_graph,
std::set<std::string> &all_inputs) const {
std::set<std::string> graph_inputs;
std::set<std::string> graph_outputs;
std::unordered_set<std::string> graph_inputs;
std::unordered_set<std::string> graph_outputs;
for (int i = 0; i < onnx_graph.node_size(); i++) {
ge::onnx::NodeProto *node_proto = onnx_graph.mutable_node(i);
for (int j = 0; j < node_proto->input_size(); j++) {
@@ -106,10 +107,12 @@ domi::Status IfSubgraphAdapter::GetSubgraphsAllInputs(ge::onnx::GraphProto &onnx
graph_outputs.emplace(node_proto->output(j));
}
}

std::unordered_set<std::string> graph_initializer_tensors;
for (int32_t i = 0; i < onnx_graph.initializer_size(); i++) {
graph_initializer_tensors.emplace(onnx_graph.initializer(i).name());
}
for (const auto &input : graph_inputs) {
std::set<std::string>::const_iterator out_iter = graph_outputs.find(input);
if (out_iter == graph_outputs.end()) {
if (graph_outputs.count(input) == 0 && graph_initializer_tensors.count(input) == 0) {
// Record input node need to be constructed
all_inputs.emplace(input);
}


+ 1
- 1
parser/tensorflow/tensorflow_parser.cc View File

@@ -2828,7 +2828,7 @@ Status EraseTransposeNode(std::map<std::string, std::string> &softmaxInfo,
itTranspose->second.node_def->input(0).c_str());
itTranspose = transposeInfo.erase(itTranspose);
} else {
itTranspose++;
++itTranspose;
}
}



Loading…
Cancel
Save