class_docstr: Spatial transformer layer
  
  The layer applies a thin plate spline transformation [2]_ on the input
  as in [1]_. The thin plate spline transform is determined based on the
  movement of some number of control points. The starting positions for
  these control points are fixed. The output is interpolated with a
  bilinear transformation.
  
  Parameters
  ----------
  incoming : a :class:`Layer` instance or a tuple
      The layer feeding into this layer, or the expected input shape. The
      output of this layer should be a 4D tensor, with shape
      ``(batch_size, num_input_channels, input_rows, input_columns)``.
  
  localization_network : a :class:`Layer` instance
      The network that calculates the parameters of the thin plate spline
      transformation as the x and y coordinates of the destination offsets of
      each control point. The output of the localization network  should
      be a 2D tensor, with shape ``(batch_size, 2 * num_control_points)``
  
  downsample_factor : float or iterable of float
      A float or a 2-element tuple specifying the downsample factor for the
      output image (in both spatial dimensions). A value of 1 will keep the
      original size of the input. Values larger than 1 will downsample the
      input. Values below 1 will upsample the input.
  
  control_points : integer
      The number of control points to be used for the thin plate spline
      transformation. These points will be arranged as a grid along the
      image, so the value must be a perfect square. Default is 16.
  
  precompute_grid : 'auto' or boolean
      Flag to precompute the U function [2]_ for the grid and source
      points. If 'auto', will be set to true as long as the input height
      and width are specified. If true, the U function is computed when the
      layer is constructed for a fixed input shape. If false, grid will be
      computed as part of the Theano computational graph, which is
      substantially slower as this computation scales with
      num_pixels*num_control_points. Default is 'auto'.
  border_mode : 'nearest', 'mirror', or 'wrap'
      Determines how border conditions are handled during interpolation.  If
      'nearest', points outside the grid are clipped to the boundary'. If
      'mirror', points are mirrored across the boundary. If 'wrap', points
      wrap around to the other side of the grid.  See
      http://stackoverflow.com/q/22669252/22670830#22670830 for details.
  
  References
  ----------
  .. [1]  Max Jaderberg, Karen Simonyan, Andrew Zisserman,
          Koray Kavukcuoglu (2015):
          Spatial Transformer Networks. NIPS 2015,
          http://papers.nips.cc/paper/5854-spatial-transformer-networks.pdf
  .. [2]  Fred L. Bookstein (1989):
          Principal warps: thin-plate splines and the decomposition of
          deformations. IEEE Transactions on
          Pattern Analysis and Machine Intelligence.
          http://doi.org/10.1109/34.24792
  
  Examples
  --------
  Here, we'll implement an identity transform using a thin plate spline
  transform. First we'll create the destination control point offsets. To
  make everything invariant to the shape of the image, the x and y range
  of the image is normalized to [-1, 1] as in ref [1]_. To replicate an
  identity transform, we'll set the bias to have all offsets be 0. More
  complicated transformations can easily be implemented using different x
  and y offsets (importantly, each control point can have it's own pair of
  offsets).
  
  >>> import numpy as np
  >>> import lasagne
  >>>
  >>> # Create the network
  >>> # we'll initialize the weights and biases to zero, so it starts
  >>> # as the identity transform (all control point offsets are zero)
  >>> W = b = lasagne.init.Constant(0.0)
  >>>
  >>> # Set the number of points
  >>> num_points = 16
  >>>
  >>> l_in = lasagne.layers.InputLayer((None, 3, 28, 28))
  >>> l_loc = lasagne.layers.DenseLayer(l_in, num_units=2*num_points,
  ...                                   W=W, b=b, nonlinearity=None)
  >>> l_trans = lasagne.layers.TPSTransformerLayer(l_in, l_loc,
  ...                                          control_points=num_points)
code: def get_output_for(self, inputs, **kwargs):
      # see eq. (1) and sec 3.1 in [1]
      # Get input and destination control points
      input, dest_offsets = inputs
      return _transform_thin_plate_spline(
          dest_offsets,
          input,
          self.right_mat,
          self.L_inv,
          self.source_points,
          self.out_height,
          self.out_width,
          self.precompute_grid,
          self.downsample_factor,
          self.border_mode,
      )
  
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 3 for calling the TPSTransformerLayer obj's underlying member method code with example usage: obj.get_output_for(inputs) and returns: _transform_thin_plate_spline