code: def _get_transformed_points_tps(
      new_points, source_points, coefficients, num_points, batch_size
  ):
      """
      Calculates the transformed points' value using the provided coefficients
  
      :param new_points: num_batch x 2 x num_to_transform tensor
      :param source_points: 2 x num_points array of source points
      :param coefficients: coefficients (should be shape (num_batch, 2,
          control_points + 3))
      :param num_points: the number of points
  
      :return: the x and y coordinates of each transformed point. Shape (
          num_batch, 2, num_to_transform)
      """
  
      # Calculate the U function for the new point and each source point as in
      # ref [2]
      # The U function is simply U(r) = r^2 * log(r^2), where r^2 is the
      # squared distance
  
      # Calculate the squared dist between the new point and the source points
      to_transform = new_points.dimshuffle(0, "x", 1, 2)
      stacked_transform = T.tile(to_transform, (1, num_points, 1, 1))
      r_2 = T.sum(
          (
              (
                  stacked_transform
                  - source_points.dimshuffle("x", 1, 0, "x")
              )
              ** 2
          ),
          axis=2,
      )
  
      # Take the product (r^2 * log(r^2)), being careful to avoid NaNs
      log_r_2 = T.log(r_2)
      distances = T.switch(T.isnan(log_r_2), r_2 * log_r_2, 0.0)
  
      # Add in the coefficients for the affine translation (1, x, and y,
      # corresponding to a_1, a_x, and a_y)
      upper_array = T.concatenate(
          [
              T.ones(
                  (batch_size, 1, new_points.shape[2]),
                  dtype=theano.config.floatX,
              ),
              new_points,
          ],
          axis=1,
      )
      right_mat = T.concatenate([upper_array, distances], axis=1)
  
      # Calculate the new value as the dot product
      new_value = T.batched_dot(coefficients, right_mat)
      return new_value
  
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 7 for calling a global function with example usage: _get_transformed_points_tps(new_points, source_points, coefficients, num_points, batch_size) and returns: new_value