MCPcopy Index your code
hub / github.com/dmlc/dgl / test_gat_conv

Function test_gat_conv

tests/python/tensorflow/test_nn.py:308–320  ·  view source on GitHub ↗
(g, idtype, out_dim, num_heads)

Source from the content-addressed store, hash-verified

306@pytest.mark.parametrize("out_dim", [1, 2])
307@pytest.mark.parametrize("num_heads", [1, 4])
308def test_gat_conv(g, idtype, out_dim, num_heads):
309 g = g.astype(idtype).to(F.ctx())
310 ctx = F.ctx()
311 gat = nn.GATConv(5, out_dim, num_heads)
312 feat = F.randn((g.number_of_src_nodes(), 5))
313 h = gat(g, feat)
314 assert h.shape == (g.number_of_dst_nodes(), num_heads, out_dim)
315 _, a = gat(g, feat, get_attention=True)
316 assert a.shape == (g.num_edges(), num_heads, 1)
317
318 # test residual connection
319 gat = nn.GATConv(5, out_dim, num_heads, residual=True)
320 h = gat(g, feat)
321
322
323@parametrize_idtype

Callers 1

test_nn.pyFile · 0.70

Calls 6

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

Tested by

no test coverage detected