(idtype, g, norm_type, out_dim)
| 385 | ) |
| 386 | @pytest.mark.parametrize("out_dim", [1, 2]) |
| 387 | def 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 |
no test coverage detected