class_docstr: Tests for LBFGS optimization algorithm.
class_docstr_tok: ["Tests","for","LBFGS","optimization","algorithm","."]
docstr: Can build an lbfgs_op with dynamic shapes in graph mode.
docstr_tok: ["Can","build","an","lbfgs_op","with","dynamic","shapes","in","graph","mode","."]
code: def test_dynamic_shapes(self):
      """Can build an lbfgs_op with dynamic shapes in graph mode."""
      if tf.executing_eagerly():
          return
      ndims = 60
      minimum = np.ones([ndims], dtype="float64")
      scales = np.arange(ndims, dtype="float64") + minimum
  
      @_make_val_and_grad_fn
      def quadratic(x):
          return tf.reduce_sum(
              scales * tf.math.squared_difference(x, minimum), axis=-1
          )
  
      # Test with a vector of unknown dimension, and a fully unknown shape.
      for shape in ([None], None):
          start_value = np.arange(ndims, 0, -1, dtype="float64")
          start = tf1.placeholder_with_default(start_value, shape=shape)
          lbfgs_op = lbfgs.minimize(
              quadratic, initial_position=start, tolerance=1e-8
          )
          self.assertFalse(lbfgs_op.position.shape.is_fully_defined())
  
          results = self.evaluate(lbfgs_op)
          self.assertTrue(results.converged)
          self.assertLessEqual(_norm(results.objective_gradient), 1e-8)
          self.assertArrayNear(results.position, minimum, 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_utils
  from tensorflow_probability.python.optimizer import lbfgs
label_desc: Use image node_id 16 for calling the LBfgsTest obj's underlying member method code with example usage: obj.test_dynamic_shapes() and returns: tf