docstr: Tests model with 2d batch of options.
docstr_tok: ["Tests","model","with","2d","batch","of","options","."]
code: def test_2d_batch(self):
      """Tests model with 2d batch of options."""
      dtype = tf.float64
      error_tol = 1e-2
  
      discount_rate_fn = lambda x: 0.01 * tf.ones_like(x, dtype=dtype)
      expiries = np.array([[1.0, 1.0], [2.0, 2.0]])
      maturities = np.array([[5.0, 5.0], [4.0, 4.0]])
      strikes = np.exp(-0.01 * maturities) / np.exp(-0.01 * expiries)
      price = tff.models.hjm.bond_option_price(
          strikes=strikes,
          expiries=expiries,
          maturities=maturities,
          dim=1,
          mean_reversion=self.mean_reversion_1d,
          volatility=self.volatility_1d,
          discount_rate_fn=discount_rate_fn,
          num_samples=50000,
          time_step=0.1,
          random_type=tff.math.random.RandomType.STATELESS_ANTITHETIC,
          dtype=dtype,
          seed=[1, 2],
      )
      self.assertEqual(price.dtype, dtype)
      self.assertAllEqual(price.shape, [2, 2])
      price = self.evaluate(price)
      expected = [[0.02817777, 0.02817777], [0.02042677, 0.02042677]]
      self.assertAllClose(
          price, expected, rtol=error_tol, atol=error_tol
      )
  
file_path: tf-quant-finance/tf_quant_finance/models/hjm/zero_coupon_bond_option_test.py
imports: import numpy
  import tensorflow.compat.v2
  import tf_quant_finance
  from tensorflow.python.framework import test_util
label_desc: Use image node_id 5 for calling the HJMBondOptionTest obj's underlying member method code with example usage: obj.test_2d_batch() without return types