class_docstr: A multi-layer perceptron module.
docstr: Constructs an MLP.
  
  Args:
    output_sizes: Sequence of layer sizes.
    w_init: Initializer for Linear weights.
    b_init: Initializer for Linear bias. Must be `None` if `with_bias` is
      `False`.
    with_bias: Whether or not to apply a bias in each layer.
    activation: Activation function to apply between linear layers. Defaults
      to ReLU.
    dropout_rate: Dropout rate to apply, a rate of `None` (the default) or `0`
      means no dropout will be applied.
    activate_final: Whether or not to activate the final layer of the MLP.
    name: Optional name for this module.
  
  Raises:
    ValueError: If with_bias is False and b_init is not None.
code: def __init__(
      self,
      output_sizes: Iterable[int],
      w_init: Optional[initializers.Initializer] = None,
      b_init: Optional[initializers.Initializer] = None,
      with_bias: bool = True,
      activation: Callable[[tf.Tensor], tf.Tensor] = tf.nn.relu,
      dropout_rate=None,
      activate_final: bool = False,
      name: Optional[str] = None,
  ):
      """Constructs an MLP.
  
      Args:
        output_sizes: Sequence of layer sizes.
        w_init: Initializer for Linear weights.
        b_init: Initializer for Linear bias. Must be `None` if `with_bias` is
          `False`.
        with_bias: Whether or not to apply a bias in each layer.
        activation: Activation function to apply between linear layers. Defaults
          to ReLU.
        dropout_rate: Dropout rate to apply, a rate of `None` (the default) or `0`
          means no dropout will be applied.
        activate_final: Whether or not to activate the final layer of the MLP.
        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._with_bias = with_bias
      self._w_init = w_init
      self._b_init = b_init
      self._activation = activation
      self._activate_final = activate_final
      self._dropout_rate = dropout_rate
      self._layers = []
      for index, output_size in enumerate(output_sizes):
          self._layers.append(
              linear.Linear(
                  output_size=output_size,
                  w_init=w_init,
                  b_init=b_init,
                  with_bias=with_bias,
                  name="linear_%d" % index,
              )
          )
  
file_path: sonnet/sonnet/src/nets/mlp.py
imports: from typing import Callable, Iterable, Optional
  from sonnet.src import base
  from sonnet.src import initializers
  from sonnet.src import linear
  import tensorflow
label_desc: Use image node_id 1 to create a new MLP object from inherited base classes: base with example: obj = MLP(output_sizes, w_init, b_init, with_bias, activation, dropout_rate, activate_final, name)