code: def warp_samples_to_canonical_diff(pts, verts, faces, T):
      signed_dist, f_id, closest = igl.signed_distance(
          pts, verts.detach().cpu().numpy(), faces[:, :3]
      )
  
      # differentiable barycentric interpolation
      closest_tri = verts[faces[:, :3][f_id]]
      closest = torch.from_numpy(closest).float().to(verts.device)
      v0v1 = closest_tri[:, 1] - closest_tri[:, 0]
      v0v2 = closest_tri[:, 2] - closest_tri[:, 0]
      v1v2 = closest_tri[:, 2] - closest_tri[:, 1]
      v2v0 = closest_tri[:, 0] - closest_tri[:, 2]
      v1p = closest - closest_tri[:, 1]
      v2p = closest - closest_tri[:, 2]
      N = torch.cross(v0v1, v0v2)
      denom = torch.bmm(
          N.unsqueeze(dim=1), N.unsqueeze(dim=2)
      ).squeeze()
      C1 = torch.cross(v1v2, v1p)
      u = (
          torch.bmm(N.unsqueeze(dim=1), C1.unsqueeze(dim=2)).squeeze()
          / denom
      )
      C2 = torch.cross(v2v0, v2p)
      v = (
          torch.bmm(N.unsqueeze(dim=1), C2.unsqueeze(dim=2)).squeeze()
          / denom
      )
      w = 1 - u - v
      barycentric = torch.stack([u, v, w], dim=1)
  
      T_interp = (
          T[faces[:, :3][f_id]] * barycentric[..., None, None]
      ).sum(axis=1)
      T_interp_inv = torch.inverse(T_interp)
  
      return T_interp_inv, f_id, signed_dist
  
file_path: ml-neuman/utils/ray_utils.py
imports: import numpy
  import torch
  import igl
  from geometry.pcd_projector import PointCloudProjectorNp
  from utils.constant import DEFAULT_GEO_THRESH, PERTURB_EPSILON
label_desc: Use image node_id 6 for calling a global function with example usage: warp_samples_to_canonical_diff(pts, verts, faces, T) and returns: T_interp_inv,  f_id,  signed_dist