class_docstr: Tests for BFGS optimization algorithm.
class_docstr_tok: ["Tests","for","BFGS","optimization","algorithm","."]
docstr: Tests BFGS on the Rosenbrock function.
  
  The Rosenbrock function is a standard optimization test case. In two
  dimensions, the function is (a, b > 0):
    f(x, y) = (a - x)^2 + b (y - x^2)^2
  The function has a global minimum at (a, a^2). This minimum lies inside
  a parabolic valley (y = x^2).
docstr_tok: ["Tests","BFGS","on","the","Rosenbrock","function",".","The","Rosenbrock","function","is","a","standard","optimization","test","case",".","In","two","dimensions",",","the","function","is","(","a",",","b",">","0",")",":","f","(","x",",","y",")","=","(","a","-","x",")","^2","+","b","(","y","-","x^2",")","^2","The","function","has","a","global","minimum","at","(","a",",","a^2",")",".","This","minimum","lies","inside","a","parabolic","valley","(","y","=","x^2",")","."]
code: def test_rosenbrock_2d(self):
      """Tests BFGS on the Rosenbrock function.
  
      The Rosenbrock function is a standard optimization test case. In two
      dimensions, the function is (a, b > 0):
        f(x, y) = (a - x)^2 + b (y - x^2)^2
      The function has a global minimum at (a, a^2). This minimum lies inside
      a parabolic valley (y = x^2).
      """
  
      def rosenbrock(coord):
          """The Rosenbrock function in two dimensions with a=1, b=100.
  
          Args:
            coord: A Tensor of shape [2]. The coordinate of the point to evaluate
              the function at.
  
          Returns:
            fv: A scalar tensor containing the value of the Rosenbrock function at
              the supplied point.
            dfx: Scalar tensor. The derivative of the function with respect to x.
            dfy: Scalar tensor. The derivative of the function with respect to y.
          """
          x, y = coord[0], coord[1]
          fv = (1 - x) ** 2 + 100 * (y - x**2) ** 2
          dfx = 2 * (x - 1) + 400 * x * (x**2 - y)
          dfy = 200 * (y - x**2)
          return fv, tf.stack([dfx, dfy])
  
      start = tf.constant([-1.2, 1.0])
      results = self.evaluate(
          bfgs.minimize(
              rosenbrock, initial_position=start, tolerance=1e-5
          )
      )
      self.assertTrue(results.converged)
      final_gradient = results.objective_gradient
      final_gradient_norm = _norm(final_gradient)
      self.assertLessEqual(final_gradient_norm, 1e-5)
      self.assertArrayNear(results.position, np.array([1.0, 1.0]), 1e-5)
  
imports: from absl.testing import parameterized
  import numpy
  from scipy.stats import special_ortho_group
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.math import gradient
  from tensorflow_probability.python.optimizer import bfgs
  from tensorflow_probability.python.optimizer import bfgs_utils
label_desc: Use image node_id 10 for calling the BfgsTest obj's underlying member method code with example usage: obj.test_rosenbrock_2d() and returns: fv,  tf