code: def standardize(layer, offset, scale, shared_axes="auto"):
      """
      Convenience function for standardizing inputs by applying a fixed offset
      and scale.  This is usually useful when you want the input to your network
      to, say, have zero mean and unit standard deviation over the feature
      dimensions.  This layer allows you to include the appropriate statistics to
      achieve this normalization as part of your network, and applies them to its
      input.  The statistics are supplied as the `offset` and `scale` parameters,
      which are applied to the input by subtracting `offset` and dividing by
      `scale`, sharing dimensions as specified by the `shared_axes` argument.
  
      Parameters
      ----------
      layer : a :class:`Layer` instance or a tuple
          The layer feeding into this layer, or the expected input shape.
      offset : Theano shared variable or numpy array
          The offset to apply (via subtraction) to the axis/axes being
          standardized.
      scale : Theano shared variable or numpy array
          The scale to apply (via division) to the axis/axes being standardized.
      shared_axes : 'auto', int or tuple of int
          The axis or axes to share the offset and scale over. If ``'auto'`` (the
          default), share over all axes except for the second: this will share
          scales over the minibatch dimension for dense layers, and additionally
          over all spatial dimensions for convolutional layers.
  
      Examples
      --------
      Assuming your training data exists in a 2D numpy ndarray called
      ``training_data``, you can use this function to scale input features to the
      [0, 1] range based on the training set statistics like so:
  
      >>> import lasagne
      >>> import numpy as np
      >>> training_data = np.random.standard_normal((100, 20))
      >>> input_shape = (None, training_data.shape[1])
      >>> l_in = lasagne.layers.InputLayer(input_shape)
      >>> offset = training_data.min(axis=0)
      >>> scale = training_data.max(axis=0) - training_data.min(axis=0)
      >>> l_std = standardize(l_in, offset, scale, shared_axes=0)
  
      Alternatively, to z-score your inputs based on training set statistics, you
      could set ``offset = training_data.mean(axis=0)`` and
      ``scale = training_data.std(axis=0)`` instead.
      """
      # Subtract the offset
      layer = BiasLayer(layer, -offset, shared_axes)
      # Do not optimize the offset parameter
      layer.params[layer.b].remove("trainable")
      # Divide by the scale
      layer = ScaleLayer(layer, floatX(1.0) / scale, shared_axes)
      # Do not optimize the scales parameter
      layer.params[layer.scales].remove("trainable")
      return layer
  
imports: import theano
  import theano.tensor
  import numpy
  from ..None import init
  from ..None import nonlinearities
  from ..utils import as_tuple, floatX, int_types
  from ..random import get_rng
  from .base import Layer, MergeLayer
  from theano.sandbox.rng_mrg import MRG_RandomStreams
label_desc: Use image node_id 1 for calling a global function with example usage: standardize(layer, offset, scale, shared_axes) and returns: layer