GCN model description

What is count count of input layer and count of hidden layer and count of output layer?

Count of hidden layers is 2 ([code] below).
self.conv1, self.conv2 are right?
So where are input layer and output layer in GCN model code below?

and if there are data below so what are learning in GCN model

[code]
import torch
from dgl.nn.pytorch import GraphConv
import torch.nn as nn
import torch.nn.functional as F

class Classifier(nn.Module):

def __init__(self, in_dim, hidden_dim, n_classes):

    super(Classifier, self).__init__()

    self.conv1 = GraphConv(in_dim, hidden_dim)

    self.conv2 = GraphConv(hidden_dim, hidden_dim)

    self.classify = nn.Linear(hidden_dim, n_classes)

def forward(self, g):

    # Use node degree as the initial node feature. For undirected graphs, the in-degree

    # is the same as the out_degree.

    h = g.in_degrees().view(-1, 1).float()

    # Perform graph convolution and activation function.

    h = F.relu(self.conv1(g, h))

    h = F.relu(self.conv2(g, h))

    g.ndata['h'] = h

    # Calculate graph representation by averaging all the node representations.

    hg = dgl.mean_nodes(g, 'h')

    return self.classify(hg)

I would like to question detail description to GCN model code above.
Thank you

If I got you right, it seems that you were asking about which layers would receive input features and which layers would generate outputs? In your code, it seems that self.conv1 is the input layer and self.classify is the output layer.

If I understood you wrong, you could also DM me and ask in your native language if you want to (but I would probably still answer back in this post in English for visibility to speakers of other languages).

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.