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

Function test_module_compose

tests/python/common/transforms/test_transform.py:2817–2827  ·  view source on GitHub ↗
(idtype)

Source from the content-addressed store, hash-verified

2815
2816@parametrize_idtype
2817def test_module_compose(idtype):
2818 g = dgl.graph(([0, 1], [1, 2]), idtype=idtype, device=F.ctx())
2819 transform = dgl.Compose([dgl.AddReverse(), dgl.AddSelfLoop()])
2820 new_g = transform(g)
2821 assert new_g.device == g.device
2822 assert new_g.idtype == g.idtype
2823 assert new_g.num_edges() == 7
2824
2825 src, dst = new_g.edges()
2826 eset = set(zip(list(F.asnumpy(src)), list(F.asnumpy(dst))))
2827 assert eset == {(0, 1), (1, 2), (1, 0), (2, 1), (0, 0), (1, 1), (2, 2)}
2828
2829
2830@parametrize_idtype

Callers

nothing calls this directly

Calls 6

transformFunction · 0.85
asnumpyMethod · 0.80
graphMethod · 0.45
ctxMethod · 0.45
num_edgesMethod · 0.45
edgesMethod · 0.45

Tested by

no test coverage detected