code: def test_himmelblau_batch_any(self):
      val_grad_func = tff.math.make_val_and_grad_fn(_himmelblau)
      starts = tf.constant(
          [[1, 1], [-2, 2], [-1, -1], [1, -2]], dtype=tf.float64
      )
      expected_minima = np.array(
          [
              [3, 2],
              [-2.805118, 3.131312],
              [-3.779310, -3.283186],
              [3.584428, -1.848126],
          ],
          dtype=np.float64,
      )
  
      # Run with `converged_any` stopping condition, to stop as soon as any of
      # the batch members have converged.
      batch_results = tff.math.optimizer.conjugate_gradient_minimize(
          val_grad_func,
          initial_position=starts,
          stopping_condition=tff.math.optimizer.converged_any,
          tolerance=1e-8,
      )
      batch_results = self.evaluate(batch_results)
  
      self.assertFalse(
          np.any(batch_results.failed)
      )  # None have failed.
      self.assertTrue(
          np.any(batch_results.converged)
      )  # At least one converged.
      self.assertFalse(
          np.all(batch_results.converged)
      )  # But not all did.
  
      # Converged points are near expected minima.
      for actual, expected in zip(
          batch_results.position[batch_results.converged],
          expected_minima[batch_results.converged],
      ):
          self.assertArrayNear(actual, expected, 1e-5)
      self.assertEqual(batch_results.num_iterations, 7)
      self.assertEqual(batch_results.num_objective_evaluations, 27)
  
imports: import numpy
  import tensorflow.compat.v2
  import tf_quant_finance
  from tensorflow.python.framework import test_util
label_desc: Use image node_id 17 for calling the ConjugateGradientTest obj's underlying member method code with example usage: obj.test_himmelblau_batch_any() without return types