|
|
@@ -2496,10 +2496,10 @@ Status TensorFlowModelParser::OptimizeIdentityByOutput(map<string, NodeDef *> &n |
|
|
|
domi::tensorflow::NodeDef *output_node_def = nodedef_map[output_node_name]; |
|
|
|
GE_CHECK_NOTNULL(output_node_def); |
|
|
|
if (output_node_def->op() == "_Retval") { |
|
|
|
GELOGD("_Retval Identity need optimize. node:%s", curr_node_name.c_str()); |
|
|
|
GELOGW("_Retval Identity need optimize. node:%s", curr_node_name.c_str()); |
|
|
|
output_node_def->set_input(0, curr_node_def->input(0).c_str()); |
|
|
|
has_out_retval = true; |
|
|
|
GELOGD("op %s set input(0):%s.", output_node_def->name().c_str(), curr_node_def->input(0).c_str()); |
|
|
|
GELOGW("op %s set input(0):%s.", output_node_def->name().c_str(), curr_node_def->input(0).c_str()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@@ -2508,20 +2508,20 @@ Status TensorFlowModelParser::OptimizeIdentityByOutput(map<string, NodeDef *> &n |
|
|
|
std::map<std::string, std::vector<std::pair<int32_t, int32_t>>>::const_iterator output_iter = output_map.begin(); |
|
|
|
for (; output_iter != output_map.end(); ++output_iter) { |
|
|
|
const string &output_node_name = output_iter->first; |
|
|
|
GELOGD("[test]node name:%s.", output_node_name.c_str()); |
|
|
|
GELOGW("[test]node name:%s.", output_node_name.c_str()); |
|
|
|
domi::tensorflow::NodeDef *output_node_def = nodedef_map[output_node_name]; |
|
|
|
GE_CHECK_NOTNULL(output_node_def); |
|
|
|
GELOGD("[test]op name:%s, input size:%u.", output_node_def->op().c_str(), output_node_def->input_size()); |
|
|
|
GELOGW("[test]op name:%s, input size:%u.", output_node_def->op().c_str(), output_node_def->input_size()); |
|
|
|
GE_IF_BOOL_EXEC(output_node_def->op() == "_Retval", continue); |
|
|
|
for (int k = 0; k < output_node_def->input_size(); ++k) { |
|
|
|
GELOGD("[test]input name:%s, curr_node_name:%s.", output_node_def->input(k).c_str(), curr_node_name.c_str()); |
|
|
|
GELOGW("[test]input name:%s, curr_node_name:%s.", output_node_def->input(k).c_str(), curr_node_name.c_str()); |
|
|
|
bool is_control = false; |
|
|
|
string node_name; |
|
|
|
GE_RETURN_IF_ERROR(CheckInputNodeName(output_node_def->input(k), &node_name, nullptr, &is_control)); |
|
|
|
|
|
|
|
GE_IF_BOOL_EXEC( |
|
|
|
node_name == curr_node_name, output_node_def->set_input(k, is_control ? ("^" + curr_node_def->input(0)).c_str() : curr_node_def->input(0).c_str()); |
|
|
|
GELOGD("%s op set input(%d):%s, is_control:%d.", output_node_def->name().c_str(), k, curr_node_def->input(0).c_str(), is_control);) |
|
|
|
GELOGW("%s op set input(%d):%s, is_control:%d.", output_node_def->name().c_str(), k, curr_node_def->input(0).c_str(), is_control);) |
|
|
|
} |
|
|
|
} |
|
|
|
clear_input_flag = true; |
|
|
@@ -2545,6 +2545,7 @@ Status TensorFlowModelParser::GraphDefOptimizeIdentity(domi::tensorflow::GraphDe |
|
|
|
const string &curr_node_name = curr_node_def->name(); |
|
|
|
GE_RETURN_IF_ERROR(OptimizeIdentityByOutput(nodedef_map, curr_node_name, clear_input_flag)); |
|
|
|
if (clear_input_flag) { |
|
|
|
GELOGW("[test]node name:%s.", curr_node_name.c_str()); |
|
|
|
curr_node_def->clear_input(); |
|
|
|
} |
|
|
|
} |
|
|
|