Skip to content

Commit

Permalink
Merge branch 'master' into code-coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
rusty1s authored Feb 7, 2023
2 parents 6e76bc8 + d4a89e5 commit a9e81f5
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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), [#6600](https://github.com/pyg-team/pytorch_geometric/pull/6600), [#6623](https://github.com/pyg-team/pytorch_geometric/pull/6623))
- 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), [#6618](https://github.com/pyg-team/pytorch_geometric/pull/6618), [#6619](https://github.com/pyg-team/pytorch_geometric/pull/6619), [#6621](https://github.com/pyg-team/pytorch_geometric/pull/6621), [#6623](https://github.com/pyg-team/pytorch_geometric/pull/6623))
- 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))
Expand Down
9 changes: 9 additions & 0 deletions test/profile/test_profile_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
get_gpu_memory_from_nvidia_smi,
get_model_size,
)
from torch_geometric.profile.utils import (
byte_to_megabyte,
medibyte_to_megabyte,
)
from torch_geometric.testing import onlyCUDA


Expand Down Expand Up @@ -53,3 +57,8 @@ def test_get_gpu_memory_from_nvidia_smi():
free_mem, used_mem = get_gpu_memory_from_nvidia_smi(device=0, digits=2)
assert free_mem >= 0
assert used_mem >= 0


def test_bytes_function():
assert byte_to_megabyte((1024 * 1024)) == 1.00
assert medibyte_to_megabyte(1 / 1.0485) == 1.00
21 changes: 21 additions & 0 deletions test/transforms/test_to_device.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import torch

from torch_geometric.data import Data
from torch_geometric.testing import withCUDA
from torch_geometric.transforms import ToDevice


@withCUDA
def test_to_device(device):
x = torch.randn(3, 4)
edge_index = torch.tensor([[0, 1, 1, 2], [1, 0, 2, 1]])
edge_weight = torch.randn(edge_index.size(1))

data = Data(x=x, edge_index=edge_index, edge_weight=edge_weight)

transform = ToDevice(device)
assert str(transform) == f'ToDevice({device})'

data = transform(data)
for key, value in data:
assert value.device == device
4 changes: 4 additions & 0 deletions test/utils/test_negative_sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ def test_negative_sampling():
assert neg_edge_index.size(1) == edge_index.size(1)
assert is_negative(edge_index, neg_edge_index, (4, 4), bipartite=False)

neg_edge_index = negative_sampling(edge_index, method='dense')
assert neg_edge_index.size(1) == edge_index.size(1)
assert is_negative(edge_index, neg_edge_index, (4, 4), bipartite=False)

neg_edge_index = negative_sampling(edge_index, num_neg_samples=2)
assert neg_edge_index.size(1) == 2
assert is_negative(edge_index, neg_edge_index, (4, 4), bipartite=False)
Expand Down

0 comments on commit a9e81f5

Please sign in to comment.