Issue
I saw the following procedure for GIN in this link
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
.
- GINConv()
- There is a
nn
argument e.g., defined bytorch.nn.Sequential
. Therefore in the tutorial you mentioned above can use theSequential()
method.
- There is a
- GCNConv()
- But
GCNConv()
does not havenn
argument.
- But
When you wonder about a method you don't know, searching for the method in API is a good way to solve issues :)
Answered By - jeongwhanchoi
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.