docstr: Find points with minimal SDF value on rays for P_out pixels 
docstr_tok: ["Find","points","with","minimal","SDF","value","on","rays","for","P_out","pixels"]
code: def minimal_sdf_points(
      self,
      num_pixels,
      sdf,
      cam_loc,
      ray_directions,
      mask,
      min_dis,
      max_dis,
  ):
      """Find points with minimal SDF value on rays for P_out pixels"""
  
      n_mask_points = mask.sum()
  
      n = self.n_steps
      # steps = torch.linspace(0.0, 1.0,n).cuda()
      steps = torch.empty(n).uniform_(0.0, 1.0).cuda()
      mask_max_dis = max_dis[mask].unsqueeze(-1)
      mask_min_dis = min_dis[mask].unsqueeze(-1)
      steps = (
          steps.unsqueeze(0).repeat(n_mask_points, 1)
          * (mask_max_dis - mask_min_dis)
          + mask_min_dis
      )
  
      mask_points = (
          cam_loc.unsqueeze(1)
          .repeat(1, num_pixels, 1)
          .reshape(-1, 3)[mask]
      )
      mask_rays = ray_directions[mask, :]
  
      mask_points_all = mask_points.unsqueeze(1).repeat(
          1, n, 1
      ) + steps.unsqueeze(-1) * mask_rays.unsqueeze(1).repeat(1, n, 1)
      points = mask_points_all.reshape(-1, 3)
  
      mask_sdf_all = []
      for pnts in torch.split(points, 100000, dim=0):
          mask_sdf_all.append(sdf(pnts))
  
      mask_sdf_all = torch.cat(mask_sdf_all).reshape(-1, n)
      min_vals, min_idx = mask_sdf_all.min(-1)
      min_mask_points = mask_points_all.reshape(-1, n, 3)[
          torch.arange(0, n_mask_points), min_idx
      ]
      min_mask_dist = steps.reshape(-1, n)[
          torch.arange(0, n_mask_points), min_idx
      ]
  
      return min_mask_points, min_mask_dist
  
file_path: insightface/reconstruction/PBIDR/code/model/ray_tracing.py
imports: import torch
  import torch.nn
  from utils import rend_util
label_desc: Use image node_id 6 for calling the RayTracing obj's underlying member method code with example usage: obj.minimal_sdf_points(num_pixels, sdf, cam_loc, ray_directions, mask, min_dis, max_dis) and returns: min_mask_points,  min_mask_dist