code: def layer_norm(layer, **kwargs):
      """
      Apply layer normalization to an existing layer. This is a convenience
      function modifying an existing layer to include layer normalization: It
      will steal the layer's nonlinearity if there is one (effectively
      introducing the normalization right before the nonlinearity), remove
      the layer's bias if there is one, and add a :class:`StandardizationLayer`,
      :class:`ScaleLayer`, :class:`BiasLayer`, and :class:`NonlinearityLayer` on
      top.
  
      In effect, it will standardize each input example across the feature and
      spatial dimensions (if any), followed by a scale and shift learned per
      feature, followed by the original nonlinearity, as proposed in [1]_.
  
      Parameters
      ----------
      layer : A :class:`Layer` instance
          The layer to apply the normalization to; note that it will be
          irreversibly modified as specified above
      **kwargs
          Any additional keyword arguments are passed on to the
          :class:`StandardizationLayer` constructor.
  
      Returns
      -------
      StandardizationLayer or NonlinearityLayer instance
          The last layer stacked on top of the given modified `layer` to
          implement layer normalization with feature-wise scaling and shifting.
  
      Examples
      --------
      Just wrap any layer into a :func:`layer_norm` call on creating it:
  
      >>> from lasagne.layers import InputLayer, DenseLayer, layer_norm
      >>> from lasagne.nonlinearities import rectify
      >>> l1 = InputLayer((10, 28))
      >>> l2 = layer_norm(DenseLayer(l1, num_units=64, nonlinearity=rectify))
  
      This introduces layer normalization right before its nonlinearity:
  
      >>> from lasagne.layers import get_all_layers
      >>> [l.__class__.__name__ for l in get_all_layers(l2)]
      ['InputLayer', 'DenseLayer', 'StandardizationLayer', \
  'ScaleLayer', 'BiasLayer', 'NonlinearityLayer']
  
      References
      ----------
      .. [1] Ba, J., Kiros, J., & Hinton, G. (2016):
             Layer normalization.
             https://arxiv.org/abs/1607.06450.
      """
      nonlinearity = getattr(layer, "nonlinearity", None)
      if nonlinearity is not None:
          layer.nonlinearity = nonlinearities.identity
      ln_name = kwargs.pop("name", None) or (
          getattr(layer, "name", None) and layer.name + "_ln"
      )
      if hasattr(layer, "b") and layer.b is not None:
          del layer.params[layer.b]
          layer.b = None
      layer = StandardizationLayer(
          layer, axes="features", name=ln_name, **kwargs
      )
      scale_name = ln_name and ln_name + "_scale"
      from .special import ScaleLayer
  
      layer = ScaleLayer(layer, shared_axes="auto", name=scale_name)
      from .special import BiasLayer
  
      bias_name = ln_name and ln_name + "_bias"
      layer = BiasLayer(layer, shared_axes="auto", name=bias_name)
  
      if nonlinearity is not None:
          from .special import NonlinearityLayer
  
          nonlin_name = ln_name and ln_name + "_nonlin"
          layer = NonlinearityLayer(
              layer, nonlinearity, name=nonlin_name
          )
      return layer
  
imports: import theano
  import theano.tensor
  from ..None import init
  from ..None import nonlinearities
  from ..utils import int_types
  from .base import Layer
label_desc: Use image node_id 3 for calling a global function with example usage: layer_norm(layer) and returns: layer