@@ -54,6 +54,7 @@ def rename_variables(model, variables):
5454 + '\n shape=' + str (new_shape )
5555 variable ['name' ] = new_name
5656 rename_edge (model , old_name , new_name )
57+
5758 rename_variables (model_json , model_json ['input' ])
5859 rename_variables (model_json , model_json ['output' ])
5960
@@ -79,19 +80,13 @@ def get_links(model_json):
7980 if name in node ['input' ]:
8081 links .append ({'source' : name ,
8182 "target" : node ['name' ]})
82- # links.append({'source': name,
83- # "target": node['name'],
84- # "label": name})
8583
8684 for source_node in model_json ['node' ]:
8785 for output in source_node ['output' ]:
8886 for target_node in model_json ['node' ]:
8987 if output in target_node ['input' ]:
9088 links .append ({'source' : source_node ['name' ],
9189 'target' : target_node ['name' ]})
92- # links.append({'source': source_node['name'],
93- # 'target': target_node['name'],
94- # 'label': output})
9590
9691 return links
9792
@@ -174,7 +169,6 @@ def add_level_to_node_links(node_links):
174169 assert in_level is not None
175170 if cur_level is None or in_level >= cur_level :
176171 node_links [idx ]['level' ] = in_level + 1
177- # debug_print(node_links)
178172
179173
180174def get_level_to_all (node_links , model_json ):
@@ -249,7 +243,6 @@ def get_level_to_all(node_links, model_json):
249243 if level not in level_to_outputs :
250244 level_to_outputs [level ] = list ()
251245 level_to_outputs [level ].append (out_idx )
252- # debug_print(level_to_outputs)
253246
254247 level_to_all = dict ()
255248
@@ -302,13 +295,9 @@ def get_coordinate(x_idx, y_idx):
302295 output_to_coordinate [out_idx ] = get_coordinate (x_idx , level )
303296 x_idx += 1
304297
305- # debug_print(node_to_coordinate)
306- # debug_print(input_to_coordinate)
307- # debug_print(output_to_coordinate)
308298 return node_to_coordinate , input_to_coordinate , output_to_coordinate
309299
310300
311-
312301def add_edges (json_obj ):
313302 # TODO(daming-lu): should try to de-duplicate node's out-edge
314303 # Currently it is counted twice: 1 as out-edge, 1 as in-edge
0 commit comments