code: def __init__(
      self,
      inpt_shape,
      hiddens,
      activation=dy.rectify,
      layer_norm=False,
      pc=None,
  ):
      super().__init__(pc)
      if len(inpt_shape) != 1:
          raise ValueError("inpt_shape must be 1 dimension for MLP.")
      self.specified_activation = hasattr(activation, "__len__")
      self.activation = activation
      self.layer_norm = layer_norm
      units = [inpt_shape[0]] + hiddens
      self.Ws, self.bs = [], []
      if layer_norm:
          self.ln_gs, self.ln_bs = [], []
      for i in range(len(units) - 1):
          self.Ws.append(
              self.pc.add_parameters((units[i + 1], units[i]))
          )
          self.bs.append(self.pc.add_parameters(units[i + 1]))
          if layer_norm:
              self.ln_gs.append(self.pc.add_parameters(units[i + 1]))
              self.ln_bs.append(self.pc.add_parameters(units[i + 1]))
      self.n_layers = len(self.Ws)
  
file_path: dynet/examples/reinforcement-learning/network.py
imports: import dynet
label_desc: Use image node_id 1 to create a new MLP object from inherited base classes: Network with example: obj = MLP(inpt_shape, hiddens, activation, layer_norm, pc)