code: def test_transform_thin_plate_spline_errors(self):
      import lasagne
  
      # Check that number of inputs matches 2*num_control_points
      with pytest.raises(ValueError):
          num_control_points = 16
          l_in_a = lasagne.layers.InputLayer((None, 3, 28, 28))
          l_loc_a = lasagne.layers.DenseLayer(
              l_in_a, num_units=3 * num_control_points
          )
          l_trans = lasagne.layers.TPSTransformerLayer(
              l_in_a, l_loc_a, control_points=num_control_points
          )
  
      # Check that error is raised when precompute_grid is set to True
      # with unknown input size
      with pytest.raises(ValueError):
          l_in = lasagne.layers.InputLayer((None, 3, None, 28))
          l_loc = lasagne.layers.DenseLayer(
              lasagne.layers.ReshapeLayer(l_in, ([0], 3 * 28 * 28)),
              num_units=32,
          )
          l_trans = lasagne.layers.TPSTransformerLayer(
              l_in, l_loc, precompute_grid=True
          )
  
      # Check that input is right size
      with pytest.raises(ValueError):
          l_in_b = lasagne.layers.InputLayer((3, 28, 28))
          l_loc_b = lasagne.layers.DenseLayer(l_in_b, num_units=6)
          l_trans = lasagne.layers.TPSTransformerLayer(l_in_b, l_loc_b)
  
      # Check that number of control points is a perfect square
      with pytest.raises(ValueError):
          num_control_points = 17
          l_in_a = lasagne.layers.InputLayer((None, 3, 28, 28))
          l_loc_a = lasagne.layers.DenseLayer(
              l_in_a, num_units=2 * num_control_points
          )
          l_trans = lasagne.layers.TPSTransformerLayer(
              l_in_a, l_loc_a, control_points=num_control_points
          )
  
      # Check that the input shape is correct
      with pytest.raises(ValueError):
          num_control_points = 16
          l_in_b = lasagne.layers.InputLayer((3, 28, 28))
          l_loc_b = lasagne.layers.DenseLayer(
              l_in_b, num_units=2 * num_control_points
          )
          l_trans = lasagne.layers.TPSTransformerLayer(l_in_b, l_loc_b)
  
imports: from mock import Mock
  import numpy
  import pytest
  import theano
  from lasagne.layers import InputLayer, standardize, get_output, get_all_params
  from lasagne.utils import floatX
label_desc: Use image node_id 1 for calling the TestTPSTransformLayer obj's underlying member method code with example usage: obj.test_transform_thin_plate_spline_errors() without return types