class_docstr: Finds the intersection points of rays with the implicit surface defined
  by a signed distance function (SDF). The algorithm follows the pipeline:
  1. Initialise start and end points on rays by the intersections with
      the circumscribing sphere.
  2. Run sphere tracing from both ends.
  3. Divide the untraced segments of non-convergent rays into uniform
      intervals and find the one with the sign transition.
  4. Run the secant method to estimate the point of the sign transition.
  
  Args:
      object_bounding_sphere: The radius of the initial sphere circumscribing
          the object.
      sdf_threshold: Absolute SDF value small enough for the sphere tracer
          to consider it a surface.
      line_search_step: Length of the backward correction on sphere tracing
          iterations.
      line_step_iters: Number of backward correction iterations.
      sphere_tracing_iters: Maximum number of sphere tracing iterations
          (the actual number of iterations may be smaller if all ray
          intersections are found).
      n_steps: Number of intervals sampled for unconvergent rays.
      n_secant_steps: Number of iterations in the secant algorithm.
class_docstr_tok: ["Finds","the","intersection","points","of","rays","with","the","implicit","surface","defined","by","a","signed","distance","function","(","SDF",")",".","The","algorithm","follows","the","pipeline",":","1",".","Initialise","start","and","end","points","on","rays","by","the","intersections","with","the","circumscribing","sphere",".","2",".","Run","sphere","tracing","from","both","ends",".","3",".","Divide","the","untraced","segments","of","non-convergent","rays","into","uniform","intervals","and","find","the","one","with","the","sign","transition",".","4",".","Run","the","secant","method","to","estimate","the","point","of","the","sign","transition",".","Args",":","object_bounding_sphere",":","The","radius","of","the","initial","sphere","circumscribing","the","object",".","sdf_threshold",":","Absolute","SDF","value","small","enough","for","the","sphere","tracer","to","consider","it","a","surface",".","line_search_step",":","Length","of","the","backward","correction","on","sphere","tracing","iterations",".","line_step_iters",":","Number","of","backward","correction","iterations",".","sphere_tracing_iters",":","Maximum","number","of","sphere","tracing","iterations","(","the","actual","number","of","iterations","may","be","smaller","if","all","ray","intersections","are","found",")",".","n_steps",":","Number","of","intervals","sampled","for","unconvergent","rays",".","n_secant_steps",":","Number","of","iterations","in","the","secant","algorithm","."]
docstr: Runs the secant method for interval [z_low, z_high] for n_secant_steps
docstr_tok: ["Runs","the","secant","method","for","interval","[","z_low",",","z_high","]","for","n_secant_steps"]
code: def secant(
      self,
      sdf_low: torch.Tensor,
      sdf_high: torch.Tensor,
      z_low: torch.Tensor,
      z_high: torch.Tensor,
      cam_loc: torch.Tensor,
      ray_directions: torch.Tensor,
      sdf: nn.Module,
  ) -> torch.Tensor:
      """
      Runs the secant method for interval [z_low, z_high] for n_secant_steps
      """
  
      z_pred = (
          -sdf_low * (z_high - z_low) / (sdf_high - sdf_low) + z_low
      )
      for _ in range(self.n_secant_steps):
          p_mid = cam_loc + z_pred.unsqueeze(-1) * ray_directions
          sdf_mid = sdf(p_mid)
          ind_low = sdf_mid > 0
          if ind_low.sum() > 0:
              z_low[ind_low] = z_pred[ind_low]
              sdf_low[ind_low] = sdf_mid[ind_low]
          ind_high = sdf_mid < 0
          if ind_high.sum() > 0:
              z_high[ind_high] = z_pred[ind_high]
              sdf_high[ind_high] = sdf_mid[ind_high]
  
          z_pred = (
              -sdf_low * (z_high - z_low) / (sdf_high - sdf_low) + z_low
          )
  
      return z_pred
  
file_path: pytorch3d/pytorch3d/implicitron/models/renderer/ray_tracing.py
imports: from typing import Any, Callable, Tuple
  import torch
  import torch.nn
  from pytorch3d.implicitron.tools.config import Configurable
label_desc: Use image node_id 4 for calling the RayTracing obj's underlying member method code with example usage: obj.secant(sdf_low, sdf_high, z_low, z_high, cam_loc, ray_directions, sdf) and returns: z_pred