Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

### Fixed

- Fixed GCNConv.forward to raise an error in case edge_weight has negative values ([#10549](https://github.com/pyg-team/pytorch_geometric/pull/10549))

### Security

## [2.7.0] - 2025-10-14
Expand Down
5 changes: 5 additions & 0 deletions torch_geometric/nn/conv/gcn_conv.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,11 @@ def forward(self, x: Tensor, edge_index: Adj,
f"Please try other layers such as 'SAGEConv' or "
f"'GraphConv' instead")

if edge_weight is not None and (edge_weight < 0).any().item():
raise ValueError(f"'{self.__class__.__name__}' does not support "
f"negative edge weights as input. Please try "
f"'SignedConv' instead if they are necessary.")

if self.normalize:
if isinstance(edge_index, Tensor):
cache = self._cached_edge_index
Expand Down