sw-gong / GNN-Tutorial

Graph Neural Network Tutorial
177 stars 45 forks source link

GNN-Tutorial-solution #2

Open pjuangph opened 4 years ago

pjuangph commented 4 years ago

When I try running the example code with the latest version of pytorch_geometric, I am seeing an error with edge_index and message passing.

Inside GCNConv ` def forward(self, x, edge_index):

x has shape [N, in_channels]

    # edge_index has shape [2, E]

    ########################################################################
    #      START OF YOUR CODE (DO NOT DELETE/MODIFY THIS LINE)             #
    ########################################################################
    # Step 1: Add self-loops to the adjacency matrix.

    edge_index = add_self_loops(edge_index, num_nodes=x.size(0))

    # Step 2: Linearly transform node feature matrix.
    x = self.lin(x)

    # Step 3-5: Start propagating messages.

    return self.propagate(edge_index=edge_index, x=x) # Problem occurs here
    ########################################################################
    #                             END OF YOUR CODE                         #
    ########################################################################           `

the base class throws an error: ``` Exception has occurred: TypeError Required parameter edge_index is empty.

pjuangph commented 4 years ago

I actually resolved this issue. I'll submit my changes to your ipynb file tomorrow. Thanks for sharing your examples and codes.