class_docstr: Grid Generator of RARE, which produces P_prime by multiplying T with P 
class_docstr_tok: ["Grid","Generator","of","RARE",",","which","produces","P_prime","by","multiplying","T","with","P"]
code: def _build_P_hat(self, F, C, P):
      n = P.shape[0]  # n (= self.I_r_width x self.I_r_height)
      P_tile = np.tile(
          np.expand_dims(P, axis=1), (1, F, 1)
      )  # n x 2 -> n x 1 x 2 -> n x F x 2
      C_tile = np.expand_dims(C, axis=0)  # 1 x F x 2
      P_diff = P_tile - C_tile  # n x F x 2
      rbf_norm = np.linalg.norm(
          P_diff, ord=2, axis=2, keepdims=False
      )  # n x F
      rbf = np.multiply(
          np.square(rbf_norm), np.log(rbf_norm + self.eps)
      )  # n x F
      P_hat = np.concatenate([np.ones((n, 1)), P, rbf], axis=1)
      return P_hat
  
file_path: EasyOCR/trainer/modules/transformation.py
imports: import numpy
  import torch
  import torch.nn
  import torch.nn.functional
label_desc: Use image node_id 5 for calling the GridGenerator obj's underlying member method code with example usage: obj._build_P_hat(F, C, P) and returns: P_hat