class_docstr: MLP with linear output
docstr: MLP layers construction
  
  Paramters
  ---------
  num_layers: int
      The number of linear layers
  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
docstr_tok: ["MLP","layers","construction","Paramters","--","--","--","--","-","num_layers",":","int","The","number","of","linear","layers","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"]
code: def __init__(self, num_layers, input_dim, hidden_dim, output_dim):
      """MLP layers construction
  
      Paramters
      ---------
      num_layers: int
          The number of linear layers
      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
  
      """
      super(MLP, self).__init__()
      self.linear_or_not = True  # default is linear model
      self.num_layers = num_layers
      self.output_dim = output_dim
  
      if num_layers < 1:
          raise ValueError("number of layers should be positive!")
      elif num_layers == 1:
          # Linear model
          self.linear = torch.nn.Linear(input_dim, output_dim)
      else:
          # Multi-layer model
          self.linear_or_not = False
          self.linears = torch.nn.ModuleList()
          self.batch_norms = torch.nn.ModuleList()
  
          self.linears.append(torch.nn.Linear(input_dim, hidden_dim))
          for layer in range(num_layers - 2):
              self.linears.append(
                  torch.nn.Linear(hidden_dim, hidden_dim)
              )
          self.linears.append(torch.nn.Linear(hidden_dim, output_dim))
  
          for layer in range(num_layers - 1):
              self.batch_norms.append(torch.nn.BatchNorm1d(hidden_dim))
  
imports: import dgl
  import torch.nn.functional
  import typing
  from dgl.nn.pytorch.conv import GINConv
  from ..None import base_encoder, encoder_registry
  from ...None import _utils
label_desc: Use image node_id 1 to create a new MLP object from inherited base classes: torch.nn with example: obj = MLP(num_layers, input_dim, hidden_dim, output_dim)