class_docstr: Tests for Hager Zhang line search algorithm.
class_docstr_tok: ["Tests","for","Hager","Zhang","line","search","algorithm","."]
docstr: Tests that the results are determinsitic.
docstr_tok: ["Tests","that","the","results","are","determinsitic","."]
code: def test_determinism(self):
      """Tests that the results are determinsitic."""
      fdf = lambda x: ValueAndGradient(
          x=x, f=(x - 1.8) ** 2, df=2 * (x - 1.8)
      )
  
      def get_results():
          start = tf.constant(0.9)
          results = hager_zhang(
              fdf,
              initial_step_size=start,
              sufficient_decrease_param=0.1,
              curvature_param=0.9,
              threshold_use_approximate_wolfe_condition=1e-6,
          )
          return self.evaluate(results)
  
      res1, res2 = get_results(), get_results()
  
      self.assertTrue(res1.converged)
      self.assertEqual(res1.converged, res2.converged)
      self.assertEqual(res1.func_evals, res1.func_evals)
      self.assertEqual(res1.left.x, res2.left.x)
  
imports: import collections
  from absl.testing import parameterized
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.optimizer.linesearch.hager_zhang import hager_zhang
label_desc: Use image node_id 10 for calling the HagerZhangTest obj's underlying member method code with example usage: obj.test_determinism() and returns: self