@@ -86,12 +86,12 @@ def test_insert_node1(self):
86
86
ops = g .get_nodes ()
87
87
g .topological_sort (ops )
88
88
result = onnx_to_graphviz (g )
89
- expected = 'digraph { Placeholder__4 [op_type=Placeholder] ' \
89
+ expected = 'digraph { Placeholder__5 [op_type=Placeholder] ' \
90
90
'n1 [op_type=Abs] n7 [op_type=Abs] n2 [op_type=Abs] n3 [op_type=Abs] ' \
91
91
'n4 [op_type=Add] n5 [op_type=Abs] n6 [op_type=Identity] ' \
92
- 'n5_graph_outputs_Identity__3 [op_type=Identity] input -> n1 n1:0 -> n7 ' \
93
- 'n7:0 -> n2 n1:0 -> n3 n2:0 -> n4 n3:0 -> n4 n4:0 -> n5 n5_raw_output___2 :0 -> n6 ' \
94
- 'n5_raw_output___2 :0 -> n5_graph_outputs_Identity__3 }'
92
+ 'n5_graph_outputs_Identity__4 [op_type=Identity] input -> n1 n1:0 -> n7 ' \
93
+ 'n7:0 -> n2 n1:0 -> n3 n2:0 -> n4 n3:0 -> n4 n4:0 -> n5 n5_raw_output___3 :0 -> n6 ' \
94
+ 'n5_raw_output___3 :0 -> n5_graph_outputs_Identity__4 }'
95
95
self .assertEqual (expected , result )
96
96
97
97
def test_insert_node2 (self ):
@@ -101,11 +101,11 @@ def test_insert_node2(self):
101
101
ops = g .get_nodes ()
102
102
g .topological_sort (ops )
103
103
result = onnx_to_graphviz (g )
104
- expected = 'digraph { Placeholder__4 [op_type=Placeholder] n1 [op_type=Abs] n7 [op_type=Abs] ' \
104
+ expected = 'digraph { Placeholder__5 [op_type=Placeholder] n1 [op_type=Abs] n7 [op_type=Abs] ' \
105
105
'n3 [op_type=Abs] n2 [op_type=Abs] n4 [op_type=Add] n5 [op_type=Abs] ' \
106
- 'n6 [op_type=Identity] n5_graph_outputs_Identity__3 [op_type=Identity] ' \
106
+ 'n6 [op_type=Identity] n5_graph_outputs_Identity__4 [op_type=Identity] ' \
107
107
'input -> n1 n1:0 -> n7 n7:0 -> n3 n7:0 -> n2 n2:0 -> n4 n3:0 -> n4 n4:0 -> n5 ' \
108
- 'n5_raw_output___2 :0 -> n6 n5_raw_output___2 :0 -> n5_graph_outputs_Identity__3 }'
108
+ 'n5_raw_output___3 :0 -> n6 n5_raw_output___3 :0 -> n5_graph_outputs_Identity__4 }'
109
109
self .assertEqual (expected , result )
110
110
111
111
def test_remove_input (self ):
@@ -116,11 +116,11 @@ def test_remove_input(self):
116
116
ops = g .get_nodes ()
117
117
g .topological_sort (ops )
118
118
result = onnx_to_graphviz (g )
119
- expected = 'digraph { Placeholder__4 [op_type=Placeholder] n1 [op_type=Abs] n3 [op_type=Abs] ' \
119
+ expected = 'digraph { Placeholder__5 [op_type=Placeholder] n1 [op_type=Abs] n3 [op_type=Abs] ' \
120
120
'n2 [op_type=Abs] n4 [op_type=Add] n5 [op_type=Abs] n6 [op_type=Identity] ' \
121
- 'n5_graph_outputs_Identity__3 [op_type=Identity] input -> n1 n1:0 -> n3 ' \
122
- 'n1:0 -> n2 n2:0 -> n4 n4:0 -> n5 n5_raw_output___2 :0 -> n6 ' \
123
- 'n5_raw_output___2 :0 -> n5_graph_outputs_Identity__3 }'
121
+ 'n5_graph_outputs_Identity__4 [op_type=Identity] input -> n1 n1:0 -> n3 ' \
122
+ 'n1:0 -> n2 n2:0 -> n4 n4:0 -> n5 n5_raw_output___3 :0 -> n6 ' \
123
+ 'n5_raw_output___3 :0 -> n5_graph_outputs_Identity__4 }'
124
124
self .assertEqual (expected , result )
125
125
126
126
def test_rewrite_subgraph (self ):
@@ -144,11 +144,11 @@ def test_rewrite_subgraph(self):
144
144
g .remove_node (n .name )
145
145
g .topological_sort (ops )
146
146
result = onnx_to_graphviz (g )
147
- expected = 'digraph { Placeholder__4 [op_type=Placeholder] n1 [op_type=Abs] ' \
148
- 'n3 [op_type=Abs] n2 [op_type=Abs] ReplacedOp__5 [op_type=Sub] ' \
149
- 'n6 [op_type=Identity] n5_graph_outputs_Identity__3 [op_type=Identity] ' \
150
- 'input -> n1 n1:0 -> n3 n1:0 -> n2 n2:0 -> ReplacedOp__5 n3:0 -> ReplacedOp__5 ' \
151
- 'ReplacedOp__5 :0 -> n6 ReplacedOp__5 :0 -> n5_graph_outputs_Identity__3 }'
147
+ expected = 'digraph { Placeholder__5 [op_type=Placeholder] n1 [op_type=Abs] ' \
148
+ 'n3 [op_type=Abs] n2 [op_type=Abs] ReplacedOp__6 [op_type=Sub] ' \
149
+ 'n6 [op_type=Identity] n5_graph_outputs_Identity__4 [op_type=Identity] ' \
150
+ 'input -> n1 n1:0 -> n3 n1:0 -> n2 n2:0 -> ReplacedOp__6 n3:0 -> ReplacedOp__6 ' \
151
+ 'ReplacedOp__6 :0 -> n6 ReplacedOp__6 :0 -> n5_graph_outputs_Identity__4 }'
152
152
self .assertEqual (expected , result )
153
153
154
154
def test_match_flipped (self ):
0 commit comments