Skip to content

Weighted GCN layer produces some nans #795

@Christian-Git01

Description

@Christian-Git01

🐛 Bug

When using weighed edges as input for GCNConv-Layer, I get some nans as results which do not make any sense. The problem is connected to edge_weights. When using edge_weights=None, the problem does not occur. Changing the values of x, edge_index and edge_weights leads to different values and different positions of nans. I provide the full setup to reproduce this error below:

To Reproduce

import torch.nn as nn
import torch.nn.functional as F
import torch_geometric
import torch_geometric.nn as gnn
torch.manual_seed(0)
gcn = gnn.GCNConv(in_channels=1, out_channels=4)

x = torch.randn(10, 1)
edge_index = torch.randint(0, 10, [2, 22])
edge_weight = torch.randn(22)
y = gcn(x=x, edge_index=edge_index, edge_weight=edge_weight)
`

Expected behavior

image

Environment

  • OS: Linux
  • Python version: Python 3.7.4
  • Torch version: 1.3.0
  • CUDA version: 9.0
  • GCC version: 4.8.5

Additional context

The problem is based on issue 707

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions