def _get_transformed_points_tps(new_points, source_points, coefficients, num_points, batch_size):
 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)
 log_r_2 = T.log(r_2)
 distances = T.switch(T.isnan(log_r_2), (r_2 * log_r_2), 0.0)
 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)
 new_value = T.batched_dot(coefficients, right_mat)
 return new_value

def _get_transformed_points_tps ( new_points , source_points , coefficients , num_points , batch_size ) : 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 ) log_r_2 = T . log ( r_2 ) distances = T . switch ( T . isnan ( log_r_2 ) , ( r_2 * log_r_2 ) , 0.0 ) 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 ) new_value = T . batched_dot ( coefficients , right_mat ) return new_value
calculates the transformed points value using the provided coefficients .