code: def _line_search_inner_bisection(
      value_and_gradients_function, search_interval, active, f_lim
  ):
      """Performs bisection and updates the interval."""
      midpoint = (search_interval.left.x + search_interval.right.x) / 2
      val_mid = value_and_gradients_function(midpoint)
      is_valid_mid = hzl.is_finite(val_mid)
  
      still_active = active & is_valid_mid
      new_failed = active & ~is_valid_mid
      next_inteval = search_interval._replace(
          failed=search_interval.failed | new_failed,
          func_evals=search_interval.func_evals + 1,
      )
  
      def _apply_update():
          update_result = hzl.update(
              value_and_gradients_function,
              next_inteval.left,
              next_inteval.right,
              val_mid,
              f_lim,
              active=still_active,
          )
          return HagerZhangLineSearchResult(
              converged=next_inteval.converged,
              failed=next_inteval.failed | update_result.failed,
              iterations=next_inteval.iterations
              + update_result.iteration,
              func_evals=next_inteval.func_evals
              + update_result.num_evals,
              left=update_result.left,
              right=update_result.right,
          )
  
      return prefer_static.cond(
          tf.reduce_any(still_active),
          _apply_update,
          lambda: next_inteval,
      )
  
file_path: probability/tensorflow_probability/python/optimizer/linesearch/hager_zhang.py
imports: import collections
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.optimizer.linesearch.internal import hager_zhang_lib
label_desc: Use image node_id 5 for calling a global function with example usage: _line_search_inner_bisection(value_and_gradients_function, search_interval, active, f_lim) and returns: prefer_static, HagerZhangLineSearchResult