class_docstr: Topkpool model
class_docstr_tok: ["Topkpool","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
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"]
code: def __init__(self, args):
      """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
  
      """
      super(Topkpool, self).__init__()
      self.args = args
  
      missing_keys = list(
          set(
              [
                  "features_num",
                  "num_class",
                  "num_graph_features",
                  "num_layers",
                  "hidden",
                  "dropout",
              ]
          )
          - set(self.args.keys())
      )
      if len(missing_keys) > 0:
          raise Exception("Missing keys: %s." % ",".join(missing_keys))
      # if not self.num_layer == len(self.args["hidden"]) + 1:
      #    LOGGER.warn("Warning: layer size does not match the length of hidden units")
  
      self.num_graph_features = self.args["num_graph_features"]
      self.num_layers = self.args["num_layers"]
      assert (
          self.num_layers > 2
      ), "Number of layers in GIN should not less than 3"
      assert (
          self.num_layers == len(self.args["hidden"]) + 1
      ), "Warning: layer size does not match the length of hidden units"
  
      input_dim = self.args["features_num"]
      hidden = self.args["hidden"]
      final_dropout = self.args["dropout"]
      output_dim = self.args["num_class"]
  
      # List of MLPs
      self.gcnlayers = torch.nn.ModuleList()
      self.batch_norms = torch.nn.ModuleList()
  
      for layer in range(self.num_layers - 1):
          if layer == 0:
              self.gcnlayers.append(GraphConv(input_dim, hidden[layer]))
          else:
              self.gcnlayers.append(
                  GraphConv(hidden[layer - 1], hidden[layer])
              )
  
          # self.gcnlayers.append(GraphConv(input_dim, hidden_dim))
          self.batch_norms.append(nn.BatchNorm1d(hidden[layer]))
  
      # 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()
  
      # TopKPool
      k = 3
      self.pool = SortPooling(k)
  
      for layer in range(self.num_layers):
          if layer == 0:
              self.linears_prediction.append(
                  nn.Linear(input_dim * k, output_dim)
              )
          else:
              self.linears_prediction.append(
                  nn.Linear(hidden[layer - 1] * k, output_dim)
              )
  
      self.drop = nn.Dropout(final_dropout)
  
imports: import torch
  import torch.nn
  import torch.nn.functional
  from dgl.nn.pytorch.conv import GraphConv
  from dgl.nn.pytorch.glob import SortPooling
  from .None import register_model
  from .base import BaseAutoModel
  from ....utils import get_logger
label_desc: Use image node_id 1 to create a new Topkpool object from inherited base classes: torch.nn with example: obj = Topkpool(args)