diff --git a/CHANGELOG.md b/CHANGELOG.md index 53527a533076..aa84ef1988a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -78,7 +78,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). ### Changed - Fixed a bug in `PNAConv` and `DegreeScalerAggregation` to correctly incorporate degree statistics of isolated nodes ([#6609](https://github.com/pyg-team/pytorch_geometric/pull/6609)) -- Improved code coverage ([#6523](https://github.com/pyg-team/pytorch_geometric/pull/6523), [#6538](https://github.com/pyg-team/pytorch_geometric/pull/6538), [#6555](https://github.com/pyg-team/pytorch_geometric/pull/6555), [#6558](https://github.com/pyg-team/pytorch_geometric/pull/6558), [#6568](https://github.com/pyg-team/pytorch_geometric/pull/6568), [#6573](https://github.com/pyg-team/pytorch_geometric/pull/6573), [#6578](https://github.com/pyg-team/pytorch_geometric/pull/6578), [#6597](https://github.com/pyg-team/pytorch_geometric/pull/6597)) +- Improved code coverage ([#6523](https://github.com/pyg-team/pytorch_geometric/pull/6523), [#6538](https://github.com/pyg-team/pytorch_geometric/pull/6538), [#6555](https://github.com/pyg-team/pytorch_geometric/pull/6555), [#6558](https://github.com/pyg-team/pytorch_geometric/pull/6558), [#6568](https://github.com/pyg-team/pytorch_geometric/pull/6568), [#6573](https://github.com/pyg-team/pytorch_geometric/pull/6573), [#6578](https://github.com/pyg-team/pytorch_geometric/pull/6578), [#6597](https://github.com/pyg-team/pytorch_geometric/pull/6597), [#6600](https://github.com/pyg-team/pytorch_geometric/pull/6600)) - Fixed a bug in which `data.to_heterogeneous()` filtered attributs in the wrong dimension ([#6522](https://github.com/pyg-team/pytorch_geometric/pull/6522)) - Breaking Change: Temporal sampling will now also sample nodes with an equal timestamp to the seed time (requires `pyg-lib>0.1.0`) ([#6517](https://github.com/pyg-team/pytorch_geometric/pull/6517)) - Changed `DataLoader` workers with affinity to start at `cpu0` ([#6512](https://github.com/pyg-team/pytorch_geometric/pull/6512)) diff --git a/test/nn/aggr/test_scaler.py b/test/nn/aggr/test_scaler.py index e630a1e926ca..7cbf6db65fc7 100644 --- a/test/nn/aggr/test_scaler.py +++ b/test/nn/aggr/test_scaler.py @@ -4,7 +4,8 @@ from torch_geometric.nn import DegreeScalerAggregation -def test_degree_scaler_aggregation(): +@pytest.mark.parametrize('train_norm', [True, False]) +def test_degree_scaler_aggregation(train_norm): x = torch.randn(6, 16) index = torch.tensor([0, 0, 1, 1, 1, 2]) ptr = torch.tensor([0, 2, 5, 6]) @@ -14,7 +15,7 @@ def test_degree_scaler_aggregation(): scaler = [ 'identity', 'amplification', 'attenuation', 'linear', 'inverse_linear' ] - aggr = DegreeScalerAggregation(aggr, scaler, deg) + aggr = DegreeScalerAggregation(aggr, scaler, deg, train_norm=train_norm) assert str(aggr) == 'DegreeScalerAggregation()' out = aggr(x, index) diff --git a/test/nn/conv/test_pna_conv.py b/test/nn/conv/test_pna_conv.py index 33acd5d88c91..74ba2841eeee 100644 --- a/test/nn/conv/test_pna_conv.py +++ b/test/nn/conv/test_pna_conv.py @@ -1,3 +1,4 @@ +import pytest import torch from torch_sparse import SparseTensor @@ -12,16 +13,17 @@ ] -def test_pna_conv(): +@pytest.mark.parametrize('divide_input', [True, False]) +def test_pna_conv(divide_input): x = torch.randn(4, 16) edge_index = torch.tensor([[0, 0, 0, 1, 2, 3], [1, 2, 3, 0, 0, 0]]) + deg = torch.tensor([0, 3, 0, 1]) row, col = edge_index value = torch.rand(row.size(0), 3) adj = SparseTensor(row=row, col=col, value=value, sparse_sizes=(4, 4)) - - conv = PNAConv(16, 32, aggregators, scalers, - deg=torch.tensor([0, 3, 0, 1]), edge_dim=3, towers=4) - assert conv.__repr__() == 'PNAConv(16, 32, towers=4, edge_dim=3)' + conv = PNAConv(16, 32, aggregators, scalers, deg=deg, edge_dim=3, towers=4, + pre_layers=2, post_layers=2, divide_input=divide_input) + assert str(conv) == 'PNAConv(16, 32, towers=4, edge_dim=3)' out = conv(x, edge_index, value) assert out.size() == (4, 32) assert torch.allclose(conv(x, adj.t()), out, atol=1e-6)