docstr: Tests model with 2d batch of options.
docstr_tok: ["Tests","model","with","2d","batch","of","options","."]
code: def test_2d_batch(self, use_analytic_pricing, error_tol):
      """Tests model with 2d batch of options."""
      dtype = tf.float64
      expiries = np.array(
          [
              [self.expiries, self.expiries],
              [0.1 + self.expiries, self.expiries],
          ]
      )
      maturities = np.array(
          [
              [self.maturities, self.maturities],
              [self.maturities, 0.1 + self.maturities],
          ]
      )
      strikes = np.array(
          [
              [self.strikes, 0.01 + self.strikes],
              [self.strikes, self.strikes],
          ]
      )
      daycount_fractions = np.array(
          [
              [self.daycount_fractions, self.daycount_fractions],
              [self.daycount_fractions, self.daycount_fractions],
          ]
      )
      price = tff.models.hull_white.cap_floor_price(
          strikes=strikes,
          expiries=expiries,
          maturities=maturities,
          daycount_fractions=daycount_fractions,
          notional=100.0,
          mean_reversion=self.mean_reversion_1d,
          volatility=self.volatility_1d,
          reference_rate_fn=self.discount_rate_1d_fn,
          use_analytic_pricing=use_analytic_pricing,
          num_samples=100_000,
          time_step=0.1,
          random_type=tff.math.random.RandomType.STATELESS_ANTITHETIC,
          seed=[1, 2],
          dtype=dtype,
      )
      with self.subTest("DType"):
          self.assertEqual(price.dtype, dtype)
      with self.subTest("Shape"):
          self.assertAllEqual(price.shape, [2, 2])
      price = self.evaluate(price)
      expected = [[0.40720883, 0.14283513], [0.15395877, 0.83090286]]
      with self.subTest("Prices"):
          self.assertAllClose(
              price, expected, rtol=error_tol, atol=error_tol
          )
  
file_path: tf-quant-finance/tf_quant_finance/models/hull_white/cap_floor_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 6 for calling the HullWhiteCapFloorTest obj's underlying member method code with example usage: obj.test_2d_batch(use_analytic_pricing, error_tol) without return types