docstr: The forward function accepts the parametrizations of
  3D points sampled along projection rays. The forward
  pass is responsible for attaching a 3D vector
  and a 1D scalar representing the point's
  RGB color and opacity respectively.
  
  Args:
      ray_bundle: A RayBundle object containing the following variables:
          origins: A tensor of shape `(minibatch, ..., 3)` denoting the
              origins of the sampling rays in world coords.
          directions: A tensor of shape `(minibatch, ..., 3)`
              containing the direction vectors of sampling rays in world coords.
          lengths: A tensor of shape `(minibatch, ..., num_points_per_ray)`
              containing the lengths at which the rays are sampled.
      density_noise_std: A floating point value representing the
          variance of the random normal noise added to the output of
          the opacity function. This can prevent floating artifacts.
  
  Returns:
      rays_densities: A tensor of shape `(minibatch, ..., num_points_per_ray, 1)`
          denoting the opacity of each ray point.
      rays_colors: A tensor of shape `(minibatch, ..., num_points_per_ray, 3)`
          denoting the color of each ray point.
docstr_tok: ["The","forward","function","accepts","the","parametrizations","of","3D","points","sampled","along","projection","rays",".","The","forward","pass","is","responsible","for","attaching","a","3D","vector","and","a","1D","scalar","representing","the","point's","RGB","color","and","opacity","respectively",".","Args",":","ray_bundle",":","A","RayBundle","object","containing","the","following","variables",":","origins",":","A","tensor","of","shape","`","(","minibatch",",","...",",","3",")","`","denoting","the","origins","of","the","sampling","rays","in","world","coords",".","directions",":","A","tensor","of","shape","`","(","minibatch",",","...",",","3",")","`","containing","the","direction","vectors","of","sampling","rays","in","world","coords",".","lengths",":","A","tensor","of","shape","`","(","minibatch",",","...",",","num_points_per_ray",")","`","containing","the","lengths","at","which","the","rays","are","sampled",".","density_noise_std",":","A","floating","point","value","representing","the","variance","of","the","random","normal","noise","added","to","the","output","of","the","opacity","function",".","This","can","prevent","floating","artifacts",".","Returns",":","rays_densities",":","A","tensor","of","shape","`","(","minibatch",",","...",",","num_points_per_ray",",","1",")","`","denoting","the","opacity","of","each","ray","point",".","rays_colors",":","A","tensor","of","shape","`","(","minibatch",",","...",",","num_points_per_ray",",","3",")","`","denoting","the","color","of","each","ray","point","."]
code: def forward(
      self,
      ray_bundle: RayBundle,
      density_noise_std: float = 0.0,
      **kwargs,
  ) -> Tuple[torch.Tensor, torch.Tensor]:
      """
      The forward function accepts the parametrizations of
      3D points sampled along projection rays. The forward
      pass is responsible for attaching a 3D vector
      and a 1D scalar representing the point's
      RGB color and opacity respectively.
  
      Args:
          ray_bundle: A RayBundle object containing the following variables:
              origins: A tensor of shape `(minibatch, ..., 3)` denoting the
                  origins of the sampling rays in world coords.
              directions: A tensor of shape `(minibatch, ..., 3)`
                  containing the direction vectors of sampling rays in world coords.
              lengths: A tensor of shape `(minibatch, ..., num_points_per_ray)`
                  containing the lengths at which the rays are sampled.
          density_noise_std: A floating point value representing the
              variance of the random normal noise added to the output of
              the opacity function. This can prevent floating artifacts.
  
      Returns:
          rays_densities: A tensor of shape `(minibatch, ..., num_points_per_ray, 1)`
              denoting the opacity of each ray point.
          rays_colors: A tensor of shape `(minibatch, ..., num_points_per_ray, 3)`
              denoting the color of each ray point.
      """
      # We first convert the ray parametrizations to world
      # coordinates with `ray_bundle_to_ray_points`.
      rays_points_world = ray_bundle_to_ray_points(ray_bundle)
      # rays_points_world.shape = [minibatch x ... x 3]
  
      # For each 3D world coordinate, we obtain its harmonic embedding.
      embeds_xyz = self.harmonic_embedding_xyz(rays_points_world)
      # embeds_xyz.shape = [minibatch x ... x self.n_harmonic_functions*6 + 3]
  
      # self.mlp maps each harmonic embedding to a latent feature space.
      features = self.mlp_xyz(embeds_xyz, embeds_xyz)
      # features.shape = [minibatch x ... x self.n_hidden_neurons_xyz]
  
      rays_densities, rays_colors = self._get_densities_and_colors(
          features, ray_bundle, density_noise_std
      )
      return rays_densities, rays_colors
  
file_path: pytorch3d/projects/nerf/nerf/implicit_function.py
imports: from typing import Tuple
  import torch
  from pytorch3d.common.linear_with_repeat import LinearWithRepeat
  from pytorch3d.renderer import HarmonicEmbedding, ray_bundle_to_ray_points, RayBundle
label_desc: Use image node_id 5 for calling the NeuralRadianceField obj's underlying member method code with example usage: obj.forward(ray_bundle, density_noise_std) and returns: rays_densities,  rays_colors