class_docstr: Shape and appearance conditioned network for radiance fields.
class_docstr_tok: ["Shape","and","appearance","conditioned","network","for","radiance","fields","."]
docstr: Run both coarse and fine networks for given rays.
docstr_tok: ["Run","both","coarse","and","fine","networks","for","given","rays","."]
code: def inference(
      self,
      r_org,
      r_dir,
      latent_code,
      voxels,
      w2v_alpha,
      w2v_beta,
      near,
      far,
  ):
      """Run both coarse and fine networks for given rays."""
      # Sample points along the rays ---------------------------------------------
      ray_points_coarse, z_vals_coarse = ray.sample_1d(
          r_org,
          r_dir,
          near=near,
          far=far,
          n_samples=self.ray_samples_coarse,
          strategy=self.coarse_sampling_strategy,
      )
      # Extract the alpha for every point by looking the corresponding voxel -----
      voxel_values = voxel_functions.ray_sample_voxel_grid(
          ray_points_coarse, voxels, w2v_alpha, w2v_beta
      )
      # Sample Additional points close to the surface ----------------------------
      ray_points_fine, _ = ray.sample_inverse_transform_stratified_1d(
          r_org,
          r_dir,
          z_vals_coarse,
          tf.squeeze(voxel_values, -1),
          n_samples=self.ray_samples_fine,
          combine_z_values=True,
      )
      # Get all the features for the network (xyz, dir, latent, alpha) -----------
      posenc_xyz, posenc_dir = self.prepare_positional_encoding(
          ray_points_fine, r_dir
      )
      latent_code = utils.match_intermediate_batch_dimensions(
          latent_code, ray_points_fine
      )
      alpha = voxel_functions.ray_sample_voxel_grid(
          ray_points_fine, voxels, w2v_alpha, w2v_beta
      )
      net_inputs = tf.concat(
          [posenc_xyz, posenc_dir, latent_code, alpha], axis=-1
      )
      net_inputs = tf.reshape(
          net_inputs, [-1, tf.shape(net_inputs)[-1]]
      )
      # Run the network and render -----------------------------------------------
      rgb_density = self.model([net_inputs])
      rgb_fine, _ = self.render_network_output(
          rgb_density, ray_points_fine
      )
      return rgb_fine
  
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.sharf.voxel_functions
  import tensorflow_graphics.projects.radiance_fields.utils
  import tensorflow_graphics.rendering.volumetric.ray_radiance
label_desc: Use image node_id 10 for calling the AppearanceNetwork obj's underlying member method code with example usage: obj.inference(r_org, r_dir, latent_code, voxels, w2v_alpha, w2v_beta, near, far) and returns: rgb_fine