MCPcopy Create free account
hub / github.com/circuitnet/CircuitNet / build_graph

Function build_graph

net_delay_prediction/build_graph.py:27–40  ·  view source on GitHub ↗
(args, path_list)

Source from the content-addressed store, hash-verified

25 yield list[i:i + n]
26
27def build_graph(args, path_list):
28 for path in path_list:
29 name = os.path.basename(path)
30 net_edges = np.load(os.path.join(args.data_path, 'net_edges', name))['net_edges']
31 nodes = np.load(os.path.join(args.data_path, 'nodes', name))['nodes']
32 pin_positions = np.load(os.path.join(args.data_path, 'pin_positions', name), allow_pickle=True)['pin_positions'].item()
33 g = dgl.heterograph({
34 ('node', 'net_out', 'node'): (net_edges[:,0], net_edges[:,1]),
35 ('node', 'net_in', 'node'): (net_edges[:,1], net_edges[:,0]),
36 })
37
38 g.edges['net_out'].data['net_delay'] = torch.tensor(net_edges[:,2:]).type(torch.float32)
39 g.ndata['nf'] = torch.tensor([pin_positions[nodes[i.item()].replace('\\','')][0:4] for i in g.nodes()]).type(torch.float32)
40 dgl.save_graphs('{}/{}.bin'.format(args.save_path, name), g)
41
42
43def parse_args():

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected