class_docstr: Simple feedforward MLP torso with initial layer-norm.
  
  This MLP's first linear layer is followed by a LayerNorm layer and a tanh
  non-linearity; subsequent layers use `activation`, which defaults to elu.
  
  Note! The default activation differs from the usual MLP default of ReLU for
  legacy reasons.
class_docstr_tok: ["Simple","feedforward","MLP","torso","with","initial","layer-norm",".","This","MLP","'s","first","linear","layer","is","followed","by","a","LayerNorm","layer","and","a","tanh","non-linearity",";","subsequent","layers","use","`","activation","`",",","which","defaults","to","elu",".","Note","!","The","default","activation","differs","from","the","usual","MLP","default","of","ReLU","for","legacy","reasons","."]
docstr: Construct the MLP.
  
  Args:
    layer_sizes: a sequence of ints specifying the size of each layer.
    w_init: initializer for Linear layers.
    activation: nonlinearity to use in the MLP, defaults to elu.
      Note! The default activation differs from the usual MLP default of ReLU
      for legacy reasons.
    activate_final: whether or not to use the activation function on the final
      layer of the neural network.
    name: a name for the module.
docstr_tok: ["Construct","the","MLP",".","Args",":","layer_sizes",":","a","sequence","of","ints","specifying","the","size","of","each","layer",".","w_init",":","initializer","for","Linear","layers",".","activation",":","nonlinearity","to","use","in","the","MLP",",","defaults","to","elu",".","Note","!","The","default","activation","differs","from","the","usual","MLP","default","of","ReLU","for","legacy","reasons",".","activate_final",":","whether","or","not","to","use","the","activation","function","on","the","final","layer","of","the","neural","network",".","name",":","a","name","for","the","module","."]
code: def __init__(
      self,
      layer_sizes: Sequence[int],
      w_init: hk.initializers.Initializer = uniform_initializer,
      activation: Callable[[jnp.ndarray], jnp.ndarray] = jax.nn.elu,
      activate_final: bool = False,
      name: str = "feedforward_mlp_torso",
  ):
      """Construct the MLP.
  
      Args:
        layer_sizes: a sequence of ints specifying the size of each layer.
        w_init: initializer for Linear layers.
        activation: nonlinearity to use in the MLP, defaults to elu.
          Note! The default activation differs from the usual MLP default of ReLU
          for legacy reasons.
        activate_final: whether or not to use the activation function on the final
          layer of the neural network.
        name: a name for the module.
      """
      super().__init__(name=name)
  
      self._network = hk.Sequential(
          [
              hk.Linear(layer_sizes[0], w_init=w_init),
              hk.LayerNorm(
                  axis=-1, create_scale=True, create_offset=True
              ),
              jax.lax.tanh,
              hk.nets.MLP(
                  layer_sizes[1:],
                  w_init=w_init,
                  activation=activation,
                  activate_final=activate_final,
              ),
          ]
      )
  
file_path: acme/acme/jax/networks/continuous.py
imports: from typing import Callable, Sequence
  import haiku
  import jax
  import jax.numpy
label_desc: Use image node_id 1 to create a new LayerNormMLP object from inherited base classes: hk with example: obj = LayerNormMLP(layer_sizes, w_init, activation, activate_final, name)