code: def model(x, is_train, reuse):
      with tf.variable_scope("STN", reuse=reuse):
          nin = tl.layers.InputLayer(x, name="in")
          ## 1. Localisation network
          # use MLP as the localisation net
          nt = tl.layers.FlattenLayer(nin, name="flatten")
          nt = tl.layers.DenseLayer(
              nt, n_units=20, act=tf.nn.tanh, name="dense1"
          )
          nt = tl.layers.DropoutLayer(
              nt, keep=0.8, is_fix=True, is_train=is_train, name="drop1"
          )
          # you can also use CNN instead for MLP as the localisation net
          # nt = Conv2d(nin, 16, (3, 3), (2, 2), act=tf.nn.relu, padding='SAME', name='tc1')
          # nt = Conv2d(nt, 8, (3, 3), (2, 2), act=tf.nn.relu, padding='SAME', name='tc2')
          ## 2. Spatial transformer module (sampler)
          n = tl.layers.SpatialTransformer2dAffineLayer(
              nin, theta_layer=nt, out_size=(40, 40), name="spatial"
          )
          s = n
          ## 3. Classifier
          n = tl.layers.Conv2d(
              n,
              n_filter=16,
              filter_size=(3, 3),
              strides=(2, 2),
              act=tf.nn.relu,
              padding="SAME",
              name="conv1",
          )
  
          n = tl.layers.Conv2d(
              n,
              n_filter=16,
              filter_size=(3, 3),
              strides=(2, 2),
              act=tf.nn.relu,
              padding="SAME",
              name="conv2",
          )
          n = tl.layers.FlattenLayer(n, name="flatten2")
          n = tl.layers.DenseLayer(
              n, n_units=1024, act=tf.nn.relu, name="out1"
          )
          n = tl.layers.DenseLayer(n, n_units=10, name="out2")
      return n, s
  
file_path: TensorLayer/tests/pending/test_layers_spatial_transformer.py
imports: import os
  import unittest
  import tensorflow
  import tensorlayer
  from tests.utils import CustomTestCase
label_desc: Use image node_id 1 for calling a global function with example usage: model(x, is_train, reuse) and returns: n,  s