Skip to content

Commit 2dcec44

Browse files
committed
remove unnecessary update_proto; fix pylint
1 parent c11a5d1 commit 2dcec44

File tree

5 files changed

+2
-13
lines changed

5 files changed

+2
-13
lines changed

tf2onnx/optimizer/transpose_optimizer.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ def __init__(self, graph, output_names, debug=False):
4545
self._handler_map = {}
4646
self._force_stop = {}
4747

48-
# make sure all proto of nodes or attribtues are update to date
49-
self._g.update_proto()
5048
self._initialize_handlers()
5149
self.pre_optimize_action()
5250

@@ -74,9 +72,6 @@ def pre_optimize_action(self):
7472
if name == output_name:
7573
child.input[i] = const_name
7674
self._g.make_const(const_name, new_data)
77-
78-
# need call this to make input update synced to protobuf val
79-
self._g.update_proto()
8075
self._g.remove_node(reshape_op.name)
8176
self._g.topological_sort(self._g.get_nodes())
8277

@@ -111,7 +106,6 @@ def post_optimize_action(self):
111106
name=op_name)
112107
else:
113108
self._remove_useless_tranpose(op)
114-
self._g.update_proto()
115109
self._g.topological_sort(self._g.get_nodes())
116110

117111
def merge_duplicated_transposes(self):

tf2onnx/rewriter/bigru_rewriter.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ def process_bigru(g, bi_grus):
116116
raise ValueError(
117117
"Reverse is still used by GRU as input, cannot remove")
118118

119-
g.update_proto()
120119
return g.get_nodes()
121120

122121

tf2onnx/rewriter/bilstm_rewriter.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,6 @@ def process_bilstm(g, bi_lstms):
101101
else:
102102
raise ValueError("Reverse is still used by LSTM as input, cannot remove")
103103

104-
105-
g.update_proto()
106104
return g.get_nodes()
107105

108106

tf2onnx/rewriter/custom_rnn_rewriter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def _connect_scan_with_output(self, context, scan_node):
190190
if out_tensor_value_info.id:
191191
if self.g.opset == 8:
192192
nodes = self._adapt_scan_sequence_input_or_output("state_output_reshape",
193-
scan_node.output[index], True)
193+
scan_node.output[index], True)
194194
self.g.replace_all_inputs(self.g.get_nodes(), out_tensor_value_info.id, nodes[-1].output[0])
195195
else:
196196
self.g.replace_all_inputs(self.g.get_nodes(), out_tensor_value_info.id, scan_node.output[index])
@@ -200,7 +200,7 @@ def _connect_scan_with_output(self, context, scan_node):
200200
if out_tensor_value_info.id:
201201
if self.g.opset == 8:
202202
nodes = self._adapt_scan_sequence_input_or_output("scan_output_reshape",
203-
scan_node.output[index], True)
203+
scan_node.output[index], True)
204204
self.g.replace_all_inputs(self.g.get_nodes(), out_tensor_value_info.id, nodes[-1].output[0])
205205
else:
206206
self.g.replace_all_inputs(self.g.get_nodes(), out_tensor_value_info.id, scan_node.output[index])

tf2onnx/tfonnx.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2498,8 +2498,6 @@ def process_tf_graph(tf_graph, continue_on_error=False, verbose=False, target=No
24982498
# onnx requires topological sorting
24992499
topological_sort(g, continue_on_error)
25002500

2501-
g.update_proto()
2502-
25032501
if verbose:
25042502
print("tensorflow ops: {}".format(op_cnt))
25052503
print("tensorflow attr: {}".format(attr_cnt))

0 commit comments

Comments
 (0)