class_docstr: Tests for LBFGS optimization algorithm.
class_docstr_tok: ["Tests","for","LBFGS","optimization","algorithm","."]
docstr: Tests that the computation can be XLA-compiled.
docstr_tok: ["Tests","that","the","computation","can","be","XLA-compiled","."]
code: def test_compile(self):
      """Tests that the computation can be XLA-compiled."""
  
      self.skip_if_no_xla()
  
      dim = 25
  
      @_make_val_and_grad_fn
      def rastrigin(x):
          """The value and gradient of the Rastrigin function.
  
          The Rastrigin function is a standard optimization test case. It is a
          multimodal non-convex function. While it has a large number of local
          minima, the global minimum is located at the origin and where the function
          value is zero. The standard search domain for optimization problems is the
          hypercube [-5.12, 5.12]**d in d-dimensions.
  
          Args:
            x: Real `Tensor` of shape [2]. The position at which to evaluate the
              function.
  
          Returns:
            value_and_gradient: A tuple of two `Tensor`s containing
              value: A scalar `Tensor` of the function value at the supplied point.
              gradient: A `Tensor` of shape [2] containing the gradient of the
                function along the two axes.
          """
          return (
              tf.reduce_sum(x**2 - 10.0 * tf.cos(2 * np.pi * x))
              + 10.0 * dim
          )
  
      start_position = np.random.rand(dim) * 2.0 * 5.12 - 5.12
  
      res = tf.function(lbfgs.minimize, jit_compile=True)(
          rastrigin,
          initial_position=tf.constant(start_position),
          tolerance=1e-5,
      )
  
      # We simply verify execution & convergence.
      self.assertTrue(self.evaluate(res.converged))
  
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_utils
  from tensorflow_probability.python.optimizer import lbfgs
label_desc: Use image node_id 15 for calling the LBfgsTest obj's underlying member method code with example usage: obj.test_compile() and returns: unknown