Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
rusty1s committed Apr 3, 2023
1 parent 0fb7094 commit 3b13c3c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

### Changed

- Added support for `Data.num_edges` for native `torch.sparse.Tensor` adjacency matrices ([#7104](https://github.com/pyg-team/pytorch_geometric/pull/7104))
- Fixed crash of heterogeneous data loaders if node or edge types are missing ([#7060](https://github.com/pyg-team/pytorch_geometric/pull/7060), [#7087](https://github.com/pyg-team/pytorch_geometric/pull/7087))
- Accelerated attention-based `MultiAggregation` ([#7077](https://github.com/pyg-team/pytorch_geometric/pull/7077))
- Edges in `HeterophilousGraphDataset` are now undirected by default ([#7065](https://github.com/pyg-team/pytorch_geometric/pull/7065))
Expand Down
4 changes: 2 additions & 2 deletions torch_geometric/data/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from torch_geometric.utils import (
coalesce,
contains_isolated_nodes,
is_torch_sparse_tensor,
is_undirected,
)

Expand Down Expand Up @@ -418,8 +419,7 @@ def num_edges(self) -> int:
for value in self.values('adj', 'adj_t'):
if isinstance(value, SparseTensor):
return value.nnz()
elif isinstance(value, Tensor) and (value.is_sparse
or value.is_sparse_csr):
elif is_torch_sparse_tensor(value):
return value._nnz()
return 0

Expand Down

0 comments on commit 3b13c3c

Please sign in to comment.