code: def test_instance_norm_macro(learn_bias, learn_scale):
      from lasagne.layers import (
          Layer,
          NonlinearityLayer,
          StandardizationLayer,
          ScaleLayer,
          BiasLayer,
          instance_norm,
      )
      from lasagne.nonlinearities import identity
  
      input_shape = (2, 3, 4, 4)
      obj = object()
  
      # check if it steals the nonlinearity
      layer = Mock(Layer, output_shape=input_shape, nonlinearity=obj)
      instack = instance_norm(
          layer, learn_bias=learn_bias, learn_scale=learn_scale
      )
      assert isinstance(instack, NonlinearityLayer)
      assert layer.nonlinearity is identity
      assert instack.nonlinearity is obj
  
      # check if layers are set according to specification
      if learn_bias:
          assert isinstance(instack.input_layer, BiasLayer)
          if learn_scale:
              assert isinstance(
                  instack.input_layer.input_layer, ScaleLayer
              )
              assert isinstance(
                  instack.input_layer.input_layer.input_layer,
                  StandardizationLayer,
              )
          else:
              assert isinstance(
                  instack.input_layer.input_layer, StandardizationLayer
              )
  
      elif learn_scale:
          assert isinstance(instack.input_layer, ScaleLayer)
          assert isinstance(
              instack.input_layer.input_layer, StandardizationLayer
          )
      else:
          assert isinstance(instack.input_layer, StandardizationLayer)
  
      # check if it removes the bias
      layer = Mock(
          Layer, output_shape=input_shape, b=obj, params={obj: set()}
      )
      instack = instance_norm(layer)
      assert layer.b is None
      assert obj not in layer.params
  
      # check if it can handle an unset bias
      layer = Mock(
          Layer, output_shape=input_shape, b=None, params={obj: set()}
      )
      instack = instance_norm(layer)
      assert layer.b is None
  
imports: from mock import Mock
  import numpy
  import pytest
  import theano
label_desc: Use image node_id 4 for calling a global function with example usage: test_instance_norm_macro(learn_bias, learn_scale) without return types