class_docstr: GCN Model
  
  Attributes:
      num_layers(int): num of gcn layers
      hidden_units(int): num of hidden units
      gcn_type(str): type of gcn layer, 'gcn' for GraphConv and 'sage' for SAGEConv
      pooling_type(str): type of graph pooling to get subgraph representation
                         'sum' for sum pooling and 'center' for center pooling.
      node_attributes(Tensor, optional): node attribute
      edge_weights(Tensor, optional): edge weight
      node_embedding(Tensor, optional): pre-trained node embedding
      use_embedding(bool, optional): whether to use node embedding. Note that if 'use_embedding' is set True
                           and 'node_embedding' is None, will automatically randomly initialize node embedding.
      num_nodes(int, optional): num of nodes
      dropout(float, optional): dropout rate
      max_z(int, optional): default max vocab size of node labeling, default 1000.
class_docstr_tok: ["GCN","Model","Attributes",":","num_layers","(","int",")",":","num","of","gcn","layers","hidden_units","(","int",")",":","num","of","hidden","units","gcn_type","(","str",")",":","type","of","gcn","layer",",","'gcn","'","for","GraphConv","and","'sage","'","for","SAGEConv","pooling_type","(","str",")",":","type","of","graph","pooling","to","get","subgraph","representation","'sum","'","for","sum","pooling","and","'center","'","for","center","pooling",".","node_attributes","(","Tensor",",","optional",")",":","node","attribute","edge_weights","(","Tensor",",","optional",")",":","edge","weight","node_embedding","(","Tensor",",","optional",")",":","pre-trained","node","embedding","use_embedding","(","bool",",","optional",")",":","whether","to","use","node","embedding",".","Note","that","if","'use_embedding","'","is","set","True","and","'node_embedding","'","is","None",",","will","automatically","randomly","initialize","node","embedding",".","num_nodes","(","int",",","optional",")",":","num","of","nodes","dropout","(","float",",","optional",")",":","dropout","rate","max_z","(","int",",","optional",")",":","default","max","vocab","size","of","node","labeling",",","default","1000","."]
code: def __init__(
      self,
      num_layers,
      hidden_units,
      gcn_type="gcn",
      pooling_type="sum",
      node_attributes=None,
      edge_weights=None,
      node_embedding=None,
      use_embedding=False,
      num_nodes=None,
      dropout=0.5,
      max_z=1000,
  ):
      super(GCN, self).__init__()
      self.num_layers = num_layers
      self.dropout = dropout
      self.pooling_type = pooling_type
      self.use_attribute = False if node_attributes is None else True
      self.use_embedding = use_embedding
      self.use_edge_weight = False if edge_weights is None else True
  
      self.z_embedding = nn.Embedding(max_z, hidden_units)
      if node_attributes is not None:
          self.node_attributes_lookup = nn.Embedding.from_pretrained(
              node_attributes
          )
          self.node_attributes_lookup.weight.requires_grad = False
      if edge_weights is not None:
          self.edge_weights_lookup = nn.Embedding.from_pretrained(
              edge_weights
          )
          self.edge_weights_lookup.weight.requires_grad = False
      if node_embedding is not None:
          self.node_embedding = nn.Embedding.from_pretrained(
              node_embedding
          )
          self.node_embedding.weight.requires_grad = False
      elif use_embedding:
          self.node_embedding = nn.Embedding(num_nodes, hidden_units)
  
      initial_dim = hidden_units
      if self.use_attribute:
          initial_dim += self.node_attributes_lookup.embedding_dim
      if self.use_embedding:
          initial_dim += self.node_embedding.embedding_dim
  
      self.layers = nn.ModuleList()
      if gcn_type == "gcn":
          self.layers.append(
              GraphConv(
                  initial_dim, hidden_units, allow_zero_in_degree=True
              )
          )
          for _ in range(num_layers - 1):
              self.layers.append(
                  GraphConv(
                      hidden_units,
                      hidden_units,
                      allow_zero_in_degree=True,
                  )
              )
      elif gcn_type == "sage":
          self.layers.append(
              SAGEConv(initial_dim, hidden_units, aggregator_type="gcn")
          )
          for _ in range(num_layers - 1):
              self.layers.append(
                  SAGEConv(
                      hidden_units, hidden_units, aggregator_type="gcn"
                  )
              )
      else:
          raise ValueError("Gcn type error.")
  
      self.linear_1 = nn.Linear(hidden_units, hidden_units)
      self.linear_2 = nn.Linear(hidden_units, 1)
      if pooling_type != "sum":
          raise ValueError("Pooling type error.")
      self.pooling = SumPooling()
  
file_path: dgl/examples/pytorch/seal/model.py
imports: import torch
  import torch.nn
  import torch.nn.functional
  from dgl.nn.pytorch import GraphConv, SAGEConv, SortPooling, SumPooling
label_desc: Use image node_id 1 to create a new GCN object from inherited base classes: nn with example: obj = GCN(num_layers, hidden_units, gcn_type, pooling_type, node_attributes, edge_weights, node_embedding, use_embedding, num_nodes, dropout, max_z)