code: def instance_norm(layer, learn_scale=True, learn_bias=True, **kwargs):
      """
      Apply instance normalization to an existing layer. This is a convenience
      function modifying an existing layer to include instance 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 (because it would be effectless), and add
      a :class:`StandardizationLayer` and :class:`NonlinearityLayer` on top.
      Depending on the given arguments, an additional :class:`ScaleLayer` and
      :class:`BiasLayer` will be inserted in between.
  
      In effect, it will separately standardize each feature map of each input
      example, followed by an optional scale and shift learned per channel,
      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
      learn_scale : bool (default: True)
          Whether to add a ScaleLayer after the StandardizationLayer
      learn_bias : bool (default: True)
          Whether to add a BiasLayer after the StandardizationLayer (or the
          optional ScaleLayer)
      **kwargs
          Any additional keyword arguments are passed on to the
          :class:`StandardizationLayer` constructor.
  
      Returns
      -------
      StandardizationLayer, ScaleLayer, BiasLayer, or NonlinearityLayer instance
          The last layer stacked on top of the given modified `layer` to
          implement instance normalization with optional scaling and shifting.
  
      Examples
      --------
      Just wrap any layer into a :func:`instance_norm` call on creating it:
  
      >>> from lasagne.layers import InputLayer, Conv2DLayer, instance_norm
      >>> from lasagne.nonlinearities import rectify
      >>> l1 = InputLayer((10, 3, 28, 28))
      >>> l2 = instance_norm(Conv2DLayer(l1, num_filters=64, filter_size=3,
      ...                                nonlinearity=rectify))
  
      This introduces instance normalization right before its nonlinearity:
  
      >>> from lasagne.layers import get_all_layers
      >>> [l.__class__.__name__ for l in get_all_layers(l2)]
      ['InputLayer', 'Conv2DLayer', 'StandardizationLayer', \
  'ScaleLayer', 'BiasLayer', 'NonlinearityLayer']
  
      References
      ----------
      .. [1] Ulyanov, D., Vedaldi, A., & Lempitsky, V. (2016):
             Instance Normalization: The Missing Ingredient for Fast Stylization.
             https://arxiv.org/abs/1607.08022.
      """
      nonlinearity = getattr(layer, "nonlinearity", None)
      if nonlinearity is not None:
          layer.nonlinearity = nonlinearities.identity
      if hasattr(layer, "b") and layer.b is not None:
          del layer.params[layer.b]
          layer.b = None
      in_name = kwargs.pop("name", None) or (
          getattr(layer, "name", None) and layer.name + "_in"
      )
      layer = StandardizationLayer(
          layer, axes="spatial", name=in_name, **kwargs
      )
      if learn_scale:
          from .special import ScaleLayer
  
          scale_name = in_name and in_name + "_scale"
          layer = ScaleLayer(layer, shared_axes="auto", name=scale_name)
      if learn_bias:
          from .special import BiasLayer
  
          bias_name = in_name and in_name + "_bias"
          layer = BiasLayer(layer, shared_axes="auto", name=bias_name)
      if nonlinearity is not None:
          from .special import NonlinearityLayer
  
          nonlin_name = in_name and in_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 2 for calling a global function with example usage: instance_norm(layer, learn_scale, learn_bias) and returns: layer