class_docstr: A multi-layer perceptron module.
class_docstr_tok: ["A","multi-layer","perceptron","module","."]
docstr: Constructs an MLP.
  
  Args:
    hidden_layer_sizes: Hiddent layer sizes.
    w_init: Initializer for :class:`~haiku.Linear` weights.
    b_init: Initializer for :class:`~haiku.Linear` bias. Must be ``None`` if
      ``with_bias=False``.
    with_bias: Whether or not to apply a bias in each layer.
    activation: Activation function to apply between :class:`~haiku.Linear`
      layers. Defaults to ReLU.
    input_dropout_rate: Dropout on the input.
    hidden_dropout_rate: Dropout on the hidden layer outputs.
    spectral_normalization_lipschitz_coeff: If not None, the network will have
      spectral normalization with the given constant.
    name: Optional name for this module.
  
  Raises:
    ValueError: If ``with_bias`` is ``False`` and ``b_init`` is not ``None``.
docstr_tok: ["Constructs","an","MLP",".","Args",":","hidden_layer_sizes",":","Hiddent","layer","sizes",".","w_init",":","Initializer","for",":","class",":","`","~haiku.Linear","`","weights",".","b_init",":","Initializer","for",":","class",":","`","~haiku.Linear","`","bias",".","Must","be","``","None","``","if","``","with_bias=False","``",".","with_bias",":","Whether","or","not","to","apply","a","bias","in","each","layer",".","activation",":","Activation","function","to","apply","between",":","class",":","`","~haiku.Linear","`","layers",".","Defaults","to","ReLU",".","input_dropout_rate",":","Dropout","on","the","input",".","hidden_dropout_rate",":","Dropout","on","the","hidden","layer","outputs",".","spectral_normalization_lipschitz_coeff",":","If","not","None",",","the","network","will","have","spectral","normalization","with","the","given","constant",".","name",":","Optional","name","for","this","module",".","Raises",":","ValueError",":","If","``","with_bias","``","is","``","False","``","and","``","b_init","``","is","not","``","None","``","."]
code: def __init__(
      self,
      hidden_layer_sizes: Iterable[int],
      w_init: Optional[hk.initializers.Initializer] = None,
      b_init: Optional[hk.initializers.Initializer] = None,
      with_bias: bool = True,
      activation: Callable[[jnp.ndarray], jnp.ndarray] = jax.nn.relu,
      input_dropout_rate: float = 0.0,
      hidden_dropout_rate: float = 0.0,
      spectral_normalization_lipschitz_coeff: Optional[float] = None,
      name: Optional[str] = None,
  ):
      """Constructs an MLP.
  
      Args:
        hidden_layer_sizes: Hiddent layer sizes.
        w_init: Initializer for :class:`~haiku.Linear` weights.
        b_init: Initializer for :class:`~haiku.Linear` bias. Must be ``None`` if
          ``with_bias=False``.
        with_bias: Whether or not to apply a bias in each layer.
        activation: Activation function to apply between :class:`~haiku.Linear`
          layers. Defaults to ReLU.
        input_dropout_rate: Dropout on the input.
        hidden_dropout_rate: Dropout on the hidden layer outputs.
        spectral_normalization_lipschitz_coeff: If not None, the network will have
          spectral normalization with the given constant.
        name: Optional name for this module.
  
      Raises:
        ValueError: If ``with_bias`` is ``False`` and ``b_init`` is not ``None``.
      """
      if not with_bias and b_init is not None:
          raise ValueError(
              "When with_bias=False b_init must not be set."
          )
  
      super().__init__(name=name)
      self._activation = activation
      self._input_dropout_rate = input_dropout_rate
      self._hidden_dropout_rate = hidden_dropout_rate
      layer_sizes = list(hidden_layer_sizes) + [1]
  
      if spectral_normalization_lipschitz_coeff is not None:
          layer_lipschitz_coeff = np.power(
              spectral_normalization_lipschitz_coeff,
              1.0 / len(layer_sizes),
          )
          layer_module = functools.partial(
              SpectralNormalizedLinear,
              lipschitz_coeff=layer_lipschitz_coeff,
              w_init=w_init,
              b_init=b_init,
              with_bias=with_bias,
          )
      else:
          layer_module = functools.partial(
              hk.Linear,
              w_init=w_init,
              b_init=b_init,
              with_bias=with_bias,
          )
  
      layers = []
      for index, output_size in enumerate(layer_sizes):
          layers.append(
              layer_module(
                  output_size=output_size, name=f"linear_{index}"
              )
          )
      self._layers = tuple(layers)
  
imports: import dataclasses
  import functools
  from typing import Any, Callable, Generic, Iterable, Optional
  from acme import specs
  from acme import types
  from acme.jax import networks
  from acme.jax import utils
  from acme.jax.imitation_learning_types import DirectRLNetworks
  import haiku
  import jax
  from jax import numpy
  import numpy
label_desc: Use image node_id 1 to create a new DiscriminatorMLP object from inherited base classes: hk with example: obj = DiscriminatorMLP(hidden_layer_sizes, w_init, b_init, with_bias, activation, input_dropout_rate, hidden_dropout_rate, spectral_normalization_lipschitz_coeff, name)