docstr: Tests that bracketing works on a 1 variable scalar valued function.
docstr_tok: ["Tests","that","bracketing","works","on","a","1","variable","scalar","valued","function","."]
code: def test_bracket_simple(self):
      """Tests that bracketing works on a 1 variable scalar valued function."""
      # Example crafted to require one expansion during bracketing, and then
      # some bisection; same as case (d) in test_bracket_batching below.
      wolfe_threshold = 1e-6
      x = np.array([0.0, 1.0, 2.5, 5.0])
      y = np.array([1.0, 0.9, -2.0, 1.1])
      dy = np.array([-0.8, -0.7, 1.6, -0.8])
      fun = _test_function_x_y_dy(x, y, dy)
  
      val_a = fun(0.0)  # Value at zero.
      val_b = fun(1.0)  # Value at initial step.
      f_lim = val_a.f + (wolfe_threshold * tf.abs(val_a.f))
  
      result = self.evaluate(
          hzl.bracket(
              fun, _interval(val_a, val_b), f_lim, max_iterations=5
          )
      )
  
      self.assertEqual(result.iteration, 1)  # One expansion.
      self.assertEqual(
          result.num_evals, 2
      )  # Once bracketing, once bisecting.
      self.assertEqual(result.left.x, 0.0)
      self.assertEqual(result.right.x, 2.5)
      self.assertLess(result.left.df, 0)  # Opposite slopes.
      self.assertGreaterEqual(result.right.df, 0)
  
imports: import collections
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.math.gradient import value_and_gradient
  from tensorflow_probability.python.optimizer.linesearch.internal import hager_zhang_lib
label_desc: Use image node_id 5 for calling the HagerZhangLibTest obj's underlying member method code with example usage: obj.test_bracket_simple() without return types