docstr: Middleware is the middle part of the network. It takes the embeddings from the input embedders,
  after they were aggregated in some method (for example, concatenation) and passes it through a neural network
  which can be customizable but shared between the heads of the network.
  
  :param params: parameters object containing batchnorm, activation_function and dropout properties.
code: def __init__(self, params: MiddlewareParameters):
      """
      Middleware is the middle part of the network. It takes the embeddings from the input embedders,
      after they were aggregated in some method (for example, concatenation) and passes it through a neural network
      which can be customizable but shared between the heads of the network.
  
      :param params: parameters object containing batchnorm, activation_function and dropout properties.
      """
      super(Middleware, self).__init__()
      self.scheme = params.scheme
  
      with self.name_scope():
          self.net = nn.HybridSequential()
          if isinstance(self.scheme, MiddlewareScheme):
              blocks = self.schemes[self.scheme]
          else:
              # if scheme is specified directly, convert to MX layer if it's not a callable object
              # NOTE: if layer object is callable, it must return a gluon block when invoked
              blocks = [convert_layer(l) for l in self.scheme]
          for block in blocks:
              self.net.add(block())
              if params.batchnorm:
                  self.net.add(nn.BatchNorm())
              if params.activation_function:
                  self.net.add(
                      nn.Activation(params.activation_function)
                  )
              if params.dropout_rate:
                  self.net.add(nn.Dropout(rate=params.dropout_rate))
  
file_path: coach/rl_coach/architectures/mxnet_components/middlewares/middleware.py
imports: from typing import Union
  from types import ModuleType
  import mxnet
  from mxnet.gluon import nn
  from rl_coach.architectures.middleware_parameters import MiddlewareParameters
  from rl_coach.architectures.mxnet_components.layers import convert_layer
  from rl_coach.base_parameters import MiddlewareScheme
label_desc: Use image node_id 1 to create a new Middleware object from inherited base classes: nn with example: obj = Middleware(params)