MCPcopy
hub / github.com/dmlc/dgl / test_pickling_graph_index

Function test_pickling_graph_index

tests/python/common/test_heterograph-pickle.py:90–102  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

88
89
90def test_pickling_graph_index():
91 gi = create_graph_index(None, False)
92 gi.add_nodes(3)
93 src_idx = toindex([0, 0])
94 dst_idx = toindex([1, 2])
95 gi.add_edges(src_idx, dst_idx)
96
97 gi2 = _reconstruct_pickle(gi)
98
99 assert gi2.num_nodes() == gi.num_nodes()
100 src_idx2, dst_idx2, _ = gi2.edges()
101 assert F.array_equal(src_idx.tousertensor(), src_idx2.tousertensor())
102 assert F.array_equal(dst_idx.tousertensor(), dst_idx2.tousertensor())
103
104
105def _global_message_func(nodes):

Callers 1

Calls 8

create_graph_indexFunction · 0.90
toindexFunction · 0.90
tousertensorMethod · 0.80
_reconstruct_pickleFunction · 0.70
add_nodesMethod · 0.45
add_edgesMethod · 0.45
num_nodesMethod · 0.45
edgesMethod · 0.45

Tested by

no test coverage detected