code: def ndc_rays(H, W, focal, near, rays_o, rays_d):
      # Shift ray origins to near plane
      t = (near - rays_o[..., 2]) / rays_d[..., 2]
      rays_o = rays_o + t[..., None] * rays_d
  
      # Projection
      o0 = 1.0 / (W / (2.0 * focal)) * rays_o[..., 0] / rays_o[..., 2]
      o1 = 1.0 / (H / (2.0 * focal)) * rays_o[..., 1] / rays_o[..., 2]
      o2 = 1.0 - 2.0 * near / rays_o[..., 2]
  
      d0 = (
          1.0
          / (W / (2.0 * focal))
          * (
              rays_d[..., 0] / rays_d[..., 2]
              - rays_o[..., 0] / rays_o[..., 2]
          )
      )
      d1 = (
          1.0
          / (H / (2.0 * focal))
          * (
              rays_d[..., 1] / rays_d[..., 2]
              - rays_o[..., 1] / rays_o[..., 2]
          )
      )
      d2 = 2.0 * near / rays_o[..., 2]
  
      rays_o = torch.stack([o0, o1, o2], -1)
      rays_d = torch.stack([d0, d1, d2], -1)
  
      return rays_o, rays_d
  
file_path: slimmerf/dataLoader/ray_utils.py
imports: import torch, re
  import numpy
  from torch import searchsorted
  from kornia import create_meshgrid
label_desc: Use image node_id 7 for calling a global function with example usage: ndc_rays(H, W, focal, near, rays_o, rays_d) and returns: rays_o,  rays_d