S.EB
S.EB

Reputation: 2226

Aggregation by MLP for GIN and GCN: What is the difference?

I saw the following procedure for GIN in this link

enter image description here

and the code for a GIN layer is written like this:

self.conv1 = GINConv(Sequential(Linear(num_node_features,dim_h),
                                    BatchNorm1d(dim_h),ReLU(),
                                    Linear(dim_h,dim_h),ReLU()))

Is this an aggregation function inside the Sequential(....) or a pooling function?

Sequential(Linear(num_node_features,dim_h),
                                        BatchNorm1d(dim_h),ReLU(),
                                        Linear(dim_h,dim_h),ReLU()))

Can I do the same thing for GCN layer?

self.conv1 = GCNConv(Sequential(Linear(num_node_features,dim_h), BatchNorm1d(dim_h),ReLU(), Linear(dim_h,dim_h),ReLU())) self.conv2 = GCNConv(Sequential(Linear(dim_h,dim_h), BatchNorm1d(dim_h),ReLU(), Linear(dim_h,dim_h),ReLU()))

I get the following error:

---> 15 self.conv1 = GCNConv(Sequential(Linear(num_node_features,dim_h),
     16                                BatchNorm1d(dim_h),ReLU(),
     17                                Linear(dim_h,dim_h),ReLU()))
     18 self.conv2 = GCNConv(Sequential(Linear(dim_h,dim_h),
     19                     BatchNorm1d(dim_h),ReLU(),
     20                     Linear(dim_h,dim_h),ReLU()))
     21 self.conv3 = GCNConv(Sequential(Linear(dim_h,dim_h),
     22                                BatchNorm1d(dim_h),ReLU(),
     23                                Linear(dim_h,dim_h),ReLU()))

TypeError: GCNConv.__init__() missing 1 required positional argument: 'out_channels'

Upvotes: 0

Views: 411

Answers (1)

jeongwhanchoi
jeongwhanchoi

Reputation: 136

You can see GINConv and GCNConv API from torch_geometric.

  • GINConv()
    • There is a nn argument e.g., defined by torch.nn.Sequential. Therefore in the tutorial you mentioned above can use the Sequential() method.
  • GCNConv()
    • But GCNConv() does not have nn argument.

When you wonder about a method you don't know, searching for the method in API is a good way to solve issues :)

Upvotes: 1

Related Questions