class_docstr: Original NeRF network.
class_docstr_tok: ["Original","NeRF","network","."]
docstr: Run both coarse and fine networks for given rays.
  
  Args:
    r_org: A tensor of shape `[A, B, 3]` where A is the batch size, B is the
      number of rays.
    r_dir: A tensor of shape `[A, B, 3]` where A is the batch size, B is the
      number of rays.
  
  Returns:
    Two tensors of size `[A, B, 3]`.
docstr_tok: ["Run","both","coarse","and","fine","networks","for","given","rays",".","Args",":","r_org",":","A","tensor","of","shape","`","[","A",",","B",",","3","]","`","where","A","is","the","batch","size",",","B","is","the","number","of","rays",".","r_dir",":","A","tensor","of","shape","`","[","A",",","B",",","3","]","`","where","A","is","the","batch","size",",","B","is","the","number","of","rays",".","Returns",":","Two","tensors","of","size","`","[","A",",","B",",","3","]","`","."]
code: def inference(self, r_org, r_dir):
      """Run both coarse and fine networks for given rays.
  
      Args:
        r_org: A tensor of shape `[A, B, 3]` where A is the batch size, B is the
          number of rays.
        r_dir: A tensor of shape `[A, B, 3]` where A is the batch size, B is the
          number of rays.
  
      Returns:
        Two tensors of size `[A, B, 3]`.
      """
      ray_points_coarse, z_vals_coarse = ray.sample_1d(
          r_org,
          r_dir,
          near=self.near,
          far=self.far,
          n_samples=self.ray_samples_coarse,
          strategy=self.coarse_sampling_strategy,
      )
      posenc_features = self.prepare_positional_encoding(
          ray_points_coarse, r_dir
      )
      rgb_density = self.coarse_model(posenc_features)
      rgb_coarse, weights_coarse = self.render_network_output(
          rgb_density, ray_points_coarse
      )
      depth_map_coarse = tf.reduce_sum(
          weights_coarse * z_vals_coarse, axis=-1
      )
  
      (
          ray_points_fine,
          z_vals_fine,
      ) = ray.sample_inverse_transform_stratified_1d(
          r_org,
          r_dir,
          z_vals_coarse,
          weights_coarse,
          n_samples=self.ray_samples_fine,
          combine_z_values=True,
      )
      posenc_features = self.prepare_positional_encoding(
          ray_points_fine, r_dir
      )
      rgb_density = self.fine_model(posenc_features)
      rgb_fine, weights_fine = self.render_network_output(
          rgb_density, ray_points_fine
      )
      depth_map_fine = tf.reduce_sum(
          weights_fine * z_vals_fine, axis=-1
      )
      return rgb_fine, rgb_coarse, depth_map_fine, depth_map_coarse
  
file_path: graphics/tensorflow_graphics/projects/radiance_fields/nerf/model.py
imports: from absl import logging
  import numpy
  import tensorflow
  import tensorflow_graphics.geometry.representation.ray
  import tensorflow_graphics.math.feature_representation
  import tensorflow_graphics.projects.radiance_fields.nerf.layers
  import tensorflow_graphics.projects.radiance_fields.utils
  import tensorflow_graphics.rendering.volumetric.ray_radiance
label_desc: Use image node_id 9 for calling the NeRF obj's underlying member method code with example usage: obj.inference(r_org, r_dir) and returns: rgb_fine,  rgb_coarse,  depth_map_fine,  depth_map_coarse