f3d0dfcb7caf50d123df02773495e5b52a92bd76,test/nn/conv/test_gat_conv.py,,test_gat_conv,#,5

Before Change


    jittedconv.eval()
    assert (torch.abs(conv(x, edge_index)[0] -
            jitconv(x, edge_index)[0]) < 1e-6).all().item()
    assert (torch.abs(conv(x, edge_index)[0] -
            jittedconv(x, edge_index)[0]) < 1e-6).all().item()

    out = conv(x, edge_index, return_attention_weights=True)
    assert out[0].size() == (num_nodes, 2 * out_channels)
    assert out[1][1].size() == (edge_index.size(1) + num_nodes, 2)

After Change



    conv = GATConv(in_channels, out_channels, heads=2, dropout=0.0)
    assert conv.__repr__() == "GATConv(16, 32, heads=2)"
    out = conv(x, edge_index)
    assert out.size() == (num_nodes, 2 * out_channels)
    assert conv((x, x), edge_index).tolist() == out.tolist()

    model = Net1()
    model.conv = conv.jittable(x=x, edge_index=edge_index)
    model = torch.jit.script(model)
    assert model(x, edge_index).tolist() == out.tolist()

    result = conv(x, edge_index, return_attention_weights=True)
    assert result[0].tolist() == out.tolist()
    assert result[1][0][:, :-num_nodes].tolist() == edge_index.tolist()
    assert result[1][1].size() == (edge_index.size(1) + num_nodes, 2)
    assert conv._alpha is None

    model = Net2()
    model.conv = conv.jittable(x=x, edge_index=edge_index)
    model = torch.jit.script(model)
    assert model(x, edge_index)[0].tolist() == result[0].tolist()
    assert model(x, edge_index)[1][0].tolist() == result[1][0].tolist()
    assert model(x, edge_index)[1][1].tolist() == result[1][1].tolist()
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: rusty1s/pytorch_geometric
Commit Name: f3d0dfcb7caf50d123df02773495e5b52a92bd76
Time: 2020-06-09
Author: matthias.fey@tu-dortmund.de
File Name: test/nn/conv/test_gat_conv.py
Class Name:
Method Name: test_gat_conv


Project Name: rusty1s/pytorch_geometric
Commit Name: bef529dbb4eb10b1ec1cad14a6f630dd472dd73b
Time: 2020-06-08
Author: matthias.fey@tu-dortmund.de
File Name: test/nn/conv/test_tag_conv.py
Class Name:
Method Name: test_tag_conv


Project Name: rusty1s/pytorch_geometric
Commit Name: f8449d8979d825d7b902bed171df80a80872e7a5
Time: 2020-06-08
Author: matthias.fey@tu-dortmund.de
File Name: test/nn/conv/test_appnp.py
Class Name:
Method Name: test_appnp