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

Function test_dense_graph_conv

tests/python/mxnet/test_nn.py:387–400  ·  view source on GitHub ↗
(idtype, g, norm_type, out_dim)

Source from the content-addressed store, hash-verified

385)
386@pytest.mark.parametrize("out_dim", [1, 2])
387def test_dense_graph_conv(idtype, g, norm_type, out_dim):
388 g = g.astype(idtype).to(F.ctx())
389 ctx = F.ctx()
390 adj = g.adj_external(transpose=True, ctx=ctx).tostype("default")
391 conv = nn.GraphConv(5, out_dim, norm=norm_type, bias=True)
392 dense_conv = nn.DenseGraphConv(5, out_dim, norm=norm_type, bias=True)
393 conv.initialize(ctx=ctx)
394 dense_conv.initialize(ctx=ctx)
395 dense_conv.weight.set_data(conv.weight.data())
396 dense_conv.bias.set_data(conv.bias.data())
397 feat = F.randn((g.number_of_src_nodes(), 5))
398 out_conv = conv(g, feat)
399 out_dense_conv = dense_conv(adj, feat)
400 assert F.allclose(out_conv, out_dense_conv)
401
402
403@parametrize_idtype

Callers 1

test_nn.pyFile · 0.70

Calls 6

adj_externalMethod · 0.80
number_of_src_nodesMethod · 0.80
toMethod · 0.45
astypeMethod · 0.45
ctxMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected