deep-learningpytorchmlppytorch-geometricgraph-neural-network

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'

Solution

  • You can see GINConv and GCNConv API from torch_geometric.

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