docstr: Demonstrate that lower/upper limits can be set independently in batch.
docstr_tok: ["Demonstrate","that","lower\/upper","limits","can","be","set","independently","in","batch","."]
code: def test_calibration_batch_limits(self):
      """Demonstrate that lower/upper limits can be set independently in batch."""
      dtype = np.float64
  
      observed_prices = np.array(
          [
              [
                  20.09689284,
                  10.91953054,
                  4.25012702,
                  1.11561839,
                  0.20815853,
              ],
              [
                  3.34813209,
                  6.03578711,
                  10.2874194,
                  16.26824328,
                  23.73850935,
              ],
          ],
          dtype=dtype,
      )
  
      strikes = np.array(
          [
              [80.0, 90.0, 100.0, 110.0, 120.0],
              [80.0, 90.0, 100.0, 110.0, 120.0],
          ],
          dtype=dtype,
      )
      expiries = np.array([[0.5], [1.0]], dtype=dtype)
      forwards = 100.0
      is_call_options = np.array([[True], [False]])
  
      beta = np.array([0.5, 0.5], dtype=dtype)
  
      models, is_converged, _ = tff.models.sabr.calibration(
          prices=observed_prices,
          strikes=strikes,
          expiries=expiries,
          forwards=forwards,
          is_call_options=is_call_options,
          beta=beta,
          calibrate_beta=False,
          volvol=np.array([1.0, 1.0], dtype=dtype),
          volvol_lower_bound=np.array([0.0, 0.2]),
          volvol_upper_bound=np.array([5.0, 10.0]),
          rho=np.array([0.0, 0.0], dtype=dtype),
          rho_lower_bound=np.array([-1.0, -0.75]),
          rho_upper_bound=np.array([1.0, 0.75]),
          maximum_iterations=1000,
      )
  
      (
          calibrated_alpha,
          calibrated_beta,
          calibrated_volvol,
          calibrated_rho,
          is_converged,
      ) = self.evaluate(
          [
              models.alpha,
              models.beta,
              models.volvol,
              models.rho,
              is_converged,
          ]
      )
  
      self.assertTrue(all(is_converged))
  
      self.assertAllClose(
          calibrated_alpha, [1.5, 2.5], atol=2e-3, rtol=2e-3
      )
      self.assertAllClose(
          calibrated_beta, [0.5, 0.5], atol=2e-3, rtol=2e-3
      )
      self.assertAllClose(
          calibrated_volvol, [0.33, 0.66], atol=1e-2, rtol=5e-2
      )
      self.assertAllClose(
          calibrated_rho, [0.1, -0.1], atol=1e-2, rtol=5e-2
      )
  
file_path: tf-quant-finance/tf_quant_finance/models/sabr/approximations/calibration_test.py
imports: from absl.testing import parameterized
  import numpy
  import tensorflow.compat.v2
  import tf_quant_finance
  from tensorflow.python.framework import test_util
label_desc: Use image node_id 3 for calling the CalibrationTest obj's underlying member method code with example usage: obj.test_calibration_batch_limits() without return types