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

Function test_graph_conv2

tests/python/mxnet/test_nn.py:101–113  ·  view source on GitHub ↗
(idtype, g, norm, weight, bias, out_dim)

Source from the content-addressed store, hash-verified

99@pytest.mark.parametrize("bias", [False])
100@pytest.mark.parametrize("out_dim", [1, 2])
101def test_graph_conv2(idtype, g, norm, weight, bias, out_dim):
102 g = g.astype(idtype).to(F.ctx())
103 conv = nn.GraphConv(5, out_dim, norm=norm, weight=weight, bias=bias)
104 conv.initialize(ctx=F.ctx())
105 ext_w = F.randn((5, out_dim)).as_in_context(F.ctx())
106 nsrc = g.number_of_src_nodes()
107 ndst = g.number_of_dst_nodes()
108 h = F.randn((nsrc, 5)).as_in_context(F.ctx())
109 if weight:
110 h_out = conv(g, h)
111 else:
112 h_out = conv(g, h, ext_w)
113 assert h_out.shape == (ndst, out_dim)
114
115
116@parametrize_idtype

Callers

nothing calls this directly

Calls 5

number_of_src_nodesMethod · 0.80
number_of_dst_nodesMethod · 0.80
toMethod · 0.45
astypeMethod · 0.45
ctxMethod · 0.45

Tested by

no test coverage detected