Last active
September 16, 2022 04:58
-
-
Save tomonori-masui/74938b7d96f41c30ed4463828bc4a708 to your computer and use it in GitHub Desktop.
MLP on PyG graph data
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch.nn as nn | |
class MLP(nn.Module): | |
def __init__(self): | |
super().__init__() | |
self.layers = nn.Sequential( | |
nn.Linear(dataset.num_node_features, 64), | |
nn.ReLU(), | |
nn.Linear(64, 32), | |
nn.ReLU(), | |
nn.Linear(32, dataset.num_classes) | |
) | |
def forward(self, data): | |
x = data.x # only using node features (x) | |
output = self.layers(x) | |
return output |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment