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 = 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(nn.Linear(input_dim, hidden_dim))
          for layer in range(num_layers - 2):
              self.linears.append(nn.Linear(hidden_dim, hidden_dim))
          self.linears.append(nn.Linear(hidden_dim, output_dim))
  
          for layer in range(num_layers - 1):
              self.batch_norms.append(nn.BatchNorm1d((hidden_dim)))
  
imports: import torch
  import torch.nn
  import torch.nn.functional
  from torch.nn import Linear, ReLU, Sequential, LeakyReLU, Tanh, ELU
  from dgl.nn.pytorch.conv import GINConv
  from dgl.nn.pytorch.glob import SumPooling, AvgPooling, MaxPooling
  from torch.nn import BatchNorm1d
  from .None import register_model
  from .base import BaseAutoModel, activate_func
  from copy import deepcopy
  from ....utils import get_logger
label_desc: Use image node_id 1 to create a new MLP object from inherited base classes: nn with example: obj = MLP(num_layers, input_dim, hidden_dim, output_dim)