docstr: Generate the grid for the grid_sampler.
  Args:
      batch_C_prime: the matrix of the geometric transformation
      I_r_size: the shape of the input image
  Return:
      batch_P_prime: the grid for the grid_sampler
docstr_tok: ["Generate","the","grid","for","the","grid_sampler",".","Args",":","batch_C_prime",":","the","matrix","of","the","geometric","transformation","I_r_size",":","the","shape","of","the","input","image","Return",":","batch_P_prime",":","the","grid","for","the","grid_sampler"]
code: def forward(self, batch_C_prime, I_r_size):
      """
      Generate the grid for the grid_sampler.
      Args:
          batch_C_prime: the matrix of the geometric transformation
          I_r_size: the shape of the input image
      Return:
          batch_P_prime: the grid for the grid_sampler
      """
      C = self.build_C_paddle()
      P = self.build_P_paddle(I_r_size)
  
      inv_delta_C_tensor = self.build_inv_delta_C_paddle(C).astype(
          "float32"
      )
      P_hat_tensor = self.build_P_hat_paddle(
          C, paddle.to_tensor(P)
      ).astype("float32")
  
      inv_delta_C_tensor.stop_gradient = True
      P_hat_tensor.stop_gradient = True
  
      batch_C_ex_part_tensor = self.get_expand_tensor(batch_C_prime)
  
      batch_C_ex_part_tensor.stop_gradient = True
  
      batch_C_prime_with_zeros = paddle.concat(
          [batch_C_prime, batch_C_ex_part_tensor], axis=1
      )
      batch_T = paddle.matmul(
          inv_delta_C_tensor, batch_C_prime_with_zeros
      )
      batch_P_prime = paddle.matmul(P_hat_tensor, batch_T)
      return batch_P_prime
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import math
  import paddle
  from paddle import nn, ParamAttr
  from paddle.nn import functional
  import numpy
label_desc: Use image node_id 2 for calling the GridGenerator obj's underlying member method code with example usage: obj.forward(batch_C_prime, I_r_size) and returns: batch_P_prime