code: def _secant(val_a, val_b):
      """Returns the secant interpolation for the minimum.
  
      The secant method is a technique for finding roots of nonlinear functions.
      When finding the minimum, one applies the secant method to the derivative
      of the function.
      For an arbitrary function and a bounding interval, the secant approximation
      can produce the next point which is outside the bounding interval. However,
      with the assumption of opposite slope condtion on the interval [a,b] the new
      point c is always bracketed by [a,b]. Note that by assumption,
      f'(a) < 0 and f'(b) > 0.
      Hence c is a weighted average of a and b and thus always in [a, b].
  
      Args:
        val_a: A namedtuple with the left end point, function value and derivative,
          of the current interval (i.e. a).
        val_b: A namedtuple with the right end point, function value and derivative,
          of the current interval (i.e. b).
  
      Returns:
        approx_minimum: A scalar real `Tensor`. An approximation to the point
          at which the derivative vanishes.
      """
      return tf.math.divide_no_nan(
          val_a.x * val_b.df - val_b.x * val_a.df, val_b.df - val_a.df
      )
  
file_path: probability/tensorflow_probability/python/optimizer/linesearch/internal/hager_zhang_lib.py
imports: import collections
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import broadcast_util
  from tensorflow_probability.python.internal import prefer_static
label_desc: Use image node_id 15 for calling a global function with example usage: _secant(val_a, val_b) and returns: tf