class_docstr: Tests for Nelder-Mead optimization algorithm.
class_docstr_tok: ["Tests","for","Nelder-Mead","optimization","algorithm","."]
docstr: Tests that results with batch evaluate same as non-batch evaluate.
docstr_tok: ["Tests","that","results","with","batch","evaluate","same","as","non-batch","evaluate","."]
code: def test_batch_consistent_with_nonbatch(self):
      """Tests that results with batch evaluate same as non-batch evaluate."""
  
      def easom(z):
          """The value of the two dimensional Easom function.
  
          The Easom function is a standard optimization test function. It has
          a single global minimum at (pi, pi) which is located inside a deep
          funnel. The expression for the function is:
  
          ```None
          f(x, y) = -cos(x) cos(y) exp(-(x-pi)**2 - (y-pi)**2)
          ```
  
          Args:
            z: `Tensor` of shape [2] and real dtype. The argument at which to
              evaluate the function.
  
          Returns:
            value: Scalar real `Tensor`. The value of the Easom function at the
              supplied argument.
          """
          f1 = tf.reduce_prod(tf.cos(z), axis=-1)
          f2 = tf.exp(-tf.reduce_sum((z - np.pi) ** 2, axis=-1))
          return -f1 * f2
  
      start = tf.constant([1.3, 2.2], dtype=tf.float64)
      results_non_batch = self.evaluate(
          nelder_mead.minimize(
              easom,
              initial_vertex=start,
              func_tolerance=1e-12,
              batch_evaluate_objective=False,
          )
      )
      results_batch = self.evaluate(
          nelder_mead.minimize(
              easom,
              initial_vertex=start,
              func_tolerance=1e-12,
              batch_evaluate_objective=True,
          )
      )
      self.assertTrue(results_batch.converged)
      self.assertEqual(
          results_batch.converged, results_non_batch.converged
      )
      self.assertArrayNear(
          results_batch.position, results_non_batch.position, 1e-5
      )
  
imports: import numpy
  from scipy.stats import special_ortho_group
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.optimizer import nelder_mead
label_desc: Use image node_id 11 for calling the NelderMeadTest obj's underlying member method code with example usage: obj.test_batch_consistent_with_nonbatch() and returns: unknown