class_docstr: GIN model
class_docstr_tok: ["GIN","model"]
docstr: model parameters setting
  Paramters
  ---------
  num_layers: int
      The number of linear layers in the neural network
  num_mlp_layers: int
      The number of linear layers in mlps
  input_dim: int
      The dimensionality of input features
  hidden_dim: int
      The dimensionality of hidden units at ALL layers
  output_dim: int
      The number of classes for prediction
  final_dropout: float
      dropout ratio on the final linear layer
  learn_eps: boolean
      If True, learn epsilon to distinguish center nodes from neighbors
      If False, aggregate neighbors and center nodes altogether.
  neighbor_pooling_type: str
      how to aggregate neighbors (sum, mean, or max)
  graph_pooling_type: str
      how to aggregate entire nodes in a graph (sum, mean or max)
docstr_tok: ["model","parameters","setting","Paramters","--","--","--","--","-","num_layers",":","int","The","number","of","linear","layers","in","the","neural","network","num_mlp_layers",":","int","The","number","of","linear","layers","in","mlps","input_dim",":","int","The","dimensionality","of","input","features","hidden_dim",":","int","The","dimensionality","of","hidden","units","at","ALL","layers","output_dim",":","int","The","number","of","classes","for","prediction","final_dropout",":","float","dropout","ratio","on","the","final","linear","layer","learn_eps",":","boolean","If","True",",","learn","epsilon","to","distinguish","center","nodes","from","neighbors","If","False",",","aggregate","neighbors","and","center","nodes","altogether",".","neighbor_pooling_type",":","str","how","to","aggregate","neighbors","(","sum",",","mean",",","or","max",")","graph_pooling_type",":","str","how","to","aggregate","entire","nodes","in","a","graph","(","sum",",","mean","or","max",")"]
code: def __init__(
      self,
      num_layers,
      num_mlp_layers,
      input_dim,
      hidden_dim,
      output_dim,
      final_dropout,
      learn_eps,
      graph_pooling_type,
      neighbor_pooling_type,
  ):
      """model parameters setting
      Paramters
      ---------
      num_layers: int
          The number of linear layers in the neural network
      num_mlp_layers: int
          The number of linear layers in mlps
      input_dim: int
          The dimensionality of input features
      hidden_dim: int
          The dimensionality of hidden units at ALL layers
      output_dim: int
          The number of classes for prediction
      final_dropout: float
          dropout ratio on the final linear layer
      learn_eps: boolean
          If True, learn epsilon to distinguish center nodes from neighbors
          If False, aggregate neighbors and center nodes altogether.
      neighbor_pooling_type: str
          how to aggregate neighbors (sum, mean, or max)
      graph_pooling_type: str
          how to aggregate entire nodes in a graph (sum, mean or max)
      """
      super(GIN, self).__init__()
      self.num_layers = num_layers
      self.learn_eps = learn_eps
  
      # List of MLPs
      self.ginlayers = torch.nn.ModuleList()
      self.batch_norms = torch.nn.ModuleList()
  
      for layer in range(self.num_layers - 1):
          if layer == 0:
              mlp = MLP(
                  num_mlp_layers, input_dim, hidden_dim, hidden_dim
              )
          else:
              mlp = MLP(
                  num_mlp_layers, hidden_dim, hidden_dim, hidden_dim
              )
  
          self.ginlayers.append(
              GINConv(
                  ApplyNodeFunc(mlp),
                  neighbor_pooling_type,
                  0,
                  self.learn_eps,
              )
          )
          self.batch_norms.append(nn.BatchNorm1d(hidden_dim))
  
      # Linear function for graph poolings of output of each layer
      # which maps the output of different layers into a prediction score
      self.linears_prediction = torch.nn.ModuleList()
  
      for layer in range(num_layers):
          if layer == 0:
              self.linears_prediction.append(
                  nn.Linear(input_dim, output_dim)
              )
          else:
              self.linears_prediction.append(
                  nn.Linear(hidden_dim, output_dim)
              )
  
      self.drop = nn.Dropout(final_dropout)
  
      if graph_pooling_type == "sum":
          self.pool = SumPooling()
      elif graph_pooling_type == "mean":
          self.pool = AvgPooling()
      elif graph_pooling_type == "max":
          self.pool = MaxPooling()
      else:
          raise NotImplementedError
  
imports: import pickle
  from dgl.dataloading import GraphDataLoader
  import numpy
  from tqdm import tqdm
  import random
  import torch
  import torch.nn
  import torch.optim
  from dgl.data import GINDataset
  import torch
  import torch.nn
  import torch.nn.functional
  from dgl.nn.pytorch.conv import GINConv
  from dgl.nn.pytorch.glob import SumPooling, AvgPooling, MaxPooling
label_desc: Use image node_id 1 to create a new GIN object from inherited base classes: nn with example: obj = GIN(num_layers, num_mlp_layers, input_dim, hidden_dim, output_dim, final_dropout, learn_eps, graph_pooling_type, neighbor_pooling_type)