Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix weight in-place update #284

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

yuxuan-z19
Copy link

@yuxuan-z19 yuxuan-z19 commented Oct 23, 2024

An in-place update of self.weight in both EvolveGCNH and EvolveGCNO raises a RuntimeError, as shown in the screenshot below. This occurs while using Python 3.10.15 along with torch-2.4.0+cu121 and pyg 2.6.1, with pytorch_geometric_temporal installed from the source.

class EvolveGCNH(torch.nn.Module):
    def forward(self, X, edge_index, edge_weight):
         ...
         if self.weight is None:
            _, self.weight = self.recurrent_layer(X_tilde, self.initial_weight)
        else:
            _, self.weight = self.recurrent_layer(X_tilde, self.weight)
        ...

{9AF115E4-201B-4A69-B69F-40A216253CE6}

Inspired by the GCLSTM example, I removed self.weight and made it an argument.

@yuxuan-z19
Copy link
Author

I personally, by the way, recommend setting the num_of_nodes and in_channel arguments as follows in the examples:

train_dataset, test_dataset = split_dataset(loader, train_ratio=0.9)
# Note: EvolveGCNH(num_of_nodes, in_channel)
model = EvolveGCNH(train_dataset[0].num_nodes, train_dataset[0].num_features)

This should be helpful for those who are new to this package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant