docstr: The second part of the forward calculation.
  
  Args:
      features: the output of the common mlp (the prior part of the
          calculation), shape
          (minibatch x ... x self.n_hidden_neurons_xyz).
      ray_bundle: As for forward().
      density_noise_std:  As for forward().
  
  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","second","part","of","the","forward","calculation",".","Args",":","features",":","the","output","of","the","common","mlp","(","the","prior","part","of","the","calculation",")",",","shape","(","minibatch","x","...","x","self.n_hidden_neurons_xyz",")",".","ray_bundle",":","As","for","forward","(",")",".","density_noise_std",":","As","for","forward","(",")",".","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 _get_densities_and_colors(
      self,
      features: torch.Tensor,
      ray_bundle: RayBundle,
      density_noise_std: float,
  ) -> Tuple[torch.Tensor, torch.Tensor]:
      """
      The second part of the forward calculation.
  
      Args:
          features: the output of the common mlp (the prior part of the
              calculation), shape
              (minibatch x ... x self.n_hidden_neurons_xyz).
          ray_bundle: As for forward().
          density_noise_std:  As for forward().
  
      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.
      """
      if self.use_multiple_streams and features.is_cuda:
          current_stream = torch.cuda.current_stream(features.device)
          other_stream = torch.cuda.Stream(features.device)
          other_stream.wait_stream(current_stream)
  
          with torch.cuda.stream(other_stream):
              rays_densities = self._get_densities(
                  features, ray_bundle.lengths, density_noise_std
              )
              # rays_densities.shape = [minibatch x ... x 1] in [0-1]
  
          rays_colors = self._get_colors(
              features, ray_bundle.directions
          )
          # rays_colors.shape = [minibatch x ... x 3] in [0-1]
  
          current_stream.wait_stream(other_stream)
      else:
          # Same calculation as above, just serial.
          rays_densities = self._get_densities(
              features, ray_bundle.lengths, density_noise_std
          )
          rays_colors = self._get_colors(
              features, ray_bundle.directions
          )
      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 4 for calling the NeuralRadianceField obj's underlying member method code with example usage: obj._get_densities_and_colors(features, ray_bundle, density_noise_std) and returns: rays_densities,  rays_colors