class_docstr: Generic configuration class for multi-layer-perceptron based Model classes.
  
  `output_dims` is reached by either the provided `output_layer_dim` setting (int) OR
  by the last entry of `hidden_layer_dims`. In the latter case, no special output
  layer is added and all layers in the stack behave exactly the same. If
  `output_layer_dim` is provided, users might also change this last layer's
  activation (`output_layer_activation`) and its bias setting
  (`output_layer_use_bias`).
  
  This is a private class as users should not configure their models directly
  through this class, but use one of the sub-classes, e.g. `MLPHeadConfig` or
  `MLPEncoderConfig`.
  
  Attributes:
      input_dims: A 1D tensor indicating the input dimension, e.g. `[32]`.
      hidden_layer_dims: The sizes of the hidden layers. If an empty list,
          `output_layer_dim` must be provided (int) and only a single layer will be
          built.
      hidden_layer_use_bias: Whether to use bias on all dense layers in the network
          (excluding a possible separate output layer defined by `output_layer_dim`).
      hidden_layer_activation: The activation function to use after each layer (
          except for the output). The default activation for hidden layers is "relu".
      hidden_layer_use_layernorm: Whether to insert a LayerNorm functionality
          in between each hidden layer's output and its activation.
      hidden_layer_weights_initializer: The initializer function or class to use for
          weight initialization in the hidden layers. If `None` the default
          initializer of the respective dense layer of a framework (`"torch"` or
          `"tf2"`) is used. Note, all initializers defined in the framework `"tf2`)
          are allowed. For `"torch"` only the in-place initializers, i.e. ending with
          an underscore "_" are allowed.
      hidden_layer_weights_initializer_config: Configuration to pass into the
          initializer defined in `hidden_layer_weights_initializer`.
      hidden_layer_bias_initializer: The initializer function or class to use for
          bias initialization in the hidden layers. If `None` the default initializer
          of the respective dense layer of a framework (`"torch"` or `"tf2"`) is used.
          Note, all initializers defined in the framework `"tf2`) are allowed. For
          `"torch"` only the in-place initializers, i.e. ending with an underscore "_"
          are allowed.
      hidden_layer_bias_initializer_config: Configuration to pass into the
          initializer defined in `hidden_layer_bias_initializer`.
      output_layer_dim: An int indicating the size of the output layer. This may be
          set to `None` in case no extra output layer should be built and only the
          layers specified by `hidden_layer_dims` will be part of the network.
      output_layer_use_bias: Whether to use bias on the separate output layer, if any.
      output_layer_activation: The activation function to use for the output layer,
          if any. The default activation for the output layer, if any, is "linear",
          meaning no activation.
      output_layer_weights_initializer: The initializer function or class to use for
          weight initialization in the output layers. If `None` the default
          initializer of the respective dense layer of a framework (`"torch"` or `
          "tf2"`) is used. Note, all initializers defined in the framework `"tf2`) are
          allowed. For `"torch"` only the in-place initializers, i.e. ending with an
          underscore "_" are allowed.
      output_layer_weights_initializer_config: Configuration to pass into the
          initializer defined in `output_layer_weights_initializer`.
      output_layer_bias_initializer: The initializer function or class to use for
          bias initialization in the output layers. If `None` the default initializer
          of the respective dense layer of a framework (`"torch"` or `"tf2"`) is used.
          For `"torch"` only the in-place initializers, i.e. ending with an underscore
          "_" are allowed.
      output_layer_bias_initializer_config: Configuration to pass into the
          initializer defined in `output_layer_bias_initializer`.
class_docstr_tok: ["Generic","configuration","class","for","multi-layer-perceptron","based","Model","classes",".","`","output_dims","`","is","reached","by","either","the","provided","`","output_layer_dim","`","setting","(","int",")","OR","by","the","last","entry","of","`","hidden_layer_dims","`",".","In","the","latter","case",",","no","special","output","layer","is","added","and","all","layers","in","the","stack","behave","exactly","the","same",".","If","`","output_layer_dim","`","is","provided",",","users","might","also","change","this","last","layer's","activation","(","`","output_layer_activation","`",")","and","its","bias","setting","(","`","output_layer_use_bias","`",")",".","This","is","a","private","class","as","users","should","not","configure","their","models","directly","through","this","class",",","but","use","one","of","the","sub-classes",",","e.g",".","`","MLPHeadConfig","`","or","`","MLPEncoderConfig","`",".","Attributes",":","input_dims",":","A","1D","tensor","indicating","the","input","dimension",",","e.g",".","`","[","32","]","`",".","hidden_layer_dims",":","The","sizes","of","the","hidden","layers",".","If","an","empty","list",",","`","output_layer_dim","`","must","be","provided","(","int",")","and","only","a","single","layer","will","be","built",".","hidden_layer_use_bias",":","Whether","to","use","bias","on","all","dense","layers","in","the","network","(","excluding","a","possible","separate","output","layer","defined","by","`","output_layer_dim","`",")",".","hidden_layer_activation",":","The","activation","function","to","use","after","each","layer","(","except","for","the","output",")",".","The","default","activation","for","hidden","layers","is","``","relu","''",".","hidden_layer_use_layernorm",":","Whether","to","insert","a","LayerNorm","functionality","in","between","each","hidden","layer","'s","output","and","its","activation",".","hidden_layer_weights_initializer",":","The","initializer","function","or","class","to","use","for","weight","initialization","in","the","hidden","layers",".","If","`","None","`","the","default","initializer","of","the","respective","dense","layer","of","a","framework","(","`","``","torch","''","`","or","`","``","tf2","''","`",")","is","used",".","Note",",","all","initializers","defined","in","the","framework","`","``","tf2","`",")","are","allowed",".","For","`","``","torch","''","`","only","the","in-place","initializers",",","i.e",".","ending","with","an","underscore","``","_","''","are","allowed",".","hidden_layer_weights_initializer_config",":","Configuration","to","pass","into","the","initializer","defined","in","`","hidden_layer_weights_initializer","`",".","hidden_layer_bias_initializer",":","The","initializer","function","or","class","to","use","for","bias","initialization","in","the","hidden","layers",".","If","`","None","`","the","default","initializer","of","the","respective","dense","layer","of","a","framework","(","`","``","torch","''","`","or","`","``","tf2","''","`",")","is","used",".","Note",",","all","initializers","defined","in","the","framework","`","``","tf2","`",")","are","allowed",".","For","`","``","torch","''","`","only","the","in-place","initializers",",","i.e",".","ending","with","an","underscore","``","_","''","are","allowed",".","hidden_layer_bias_initializer_config",":","Configuration","to","pass","into","the","initializer","defined","in","`","hidden_layer_bias_initializer","`",".","output_layer_dim",":","An","int","indicating","the","size","of","the","output","layer",".","This","may","be","set","to","`","None","`","in","case","no","extra","output","layer","should","be","built","and","only","the","layers","specified","by","`","hidden_layer_dims","`","will","be","part","of","the","network",".","output_layer_use_bias",":","Whether","to","use","bias","on","the","separate","output","layer",",","if","any",".","output_layer_activation",":","The","activation","function","to","use","for","the","output","layer",",","if","any",".","The","default","activation","for","the","output","layer",",","if","any",",","is","``","linear","''",",","meaning","no","activation",".","output_layer_weights_initializer",":","The","initializer","function","or","class","to","use","for","weight","initialization","in","the","output","layers",".","If","`","None","`","the","default","initializer","of","the","respective","dense","layer","of","a","framework","(","`","``","torch","''","`","or","`","``","tf2","''","`",")","is","used",".","Note",",","all","initializers","defined","in","the","framework","`","``","tf2","`",")","are","allowed",".","For","`","``","torch","''","`","only","the","in-place","initializers",",","i.e",".","ending","with","an","underscore","``","_","''","are","allowed",".","output_layer_weights_initializer_config",":","Configuration","to","pass","into","the","initializer","defined","in","`","output_layer_weights_initializer","`",".","output_layer_bias_initializer",":","The","initializer","function","or","class","to","use","for","bias","initialization","in","the","output","layers",".","If","`","None","`","the","default","initializer","of","the","respective","dense","layer","of","a","framework","(","`","``","torch","''","`","or","`","``","tf2","''","`",")","is","used",".","For","`","``","torch","''","`","only","the","in-place","initializers",",","i.e",".","ending","with","an","underscore","``","_","''","are","allowed",".","output_layer_bias_initializer_config",":","Configuration","to","pass","into","the","initializer","defined","in","`","output_layer_bias_initializer","`","."]
code: def output_dims(self):
      if self.output_layer_dim is None and not self.hidden_layer_dims:
          raise ValueError(
              "If `output_layer_dim` is None, you must specify at least one hidden "
              "layer dim, e.g. `hidden_layer_dims=[32]`!"
          )
  
      # Infer `output_dims` automatically.
      return (self.output_layer_dim or self.hidden_layer_dims[-1],)
  
imports: import abc
  from dataclasses import dataclass, field
  import functools
  from typing import Callable, Dict, List, Optional, Tuple, TYPE_CHECKING, Union
  import numpy
  from ray.rllib.models.torch.misc import same_padding, same_padding_transpose_after_stride, valid_padding
  from ray.rllib.models.utils import get_activation_fn, get_initializer_fn
  from ray.rllib.utils.annotations import ExperimentalAPI
label_desc: Use image node_id 1 for calling the _MLPConfig obj's underlying member method code with example usage: obj.output_dims() and returns: unknown