docstr: Tests model with constant parameters in 1 dimension.
docstr_tok: ["Tests","model","with","constant","parameters","in","1","dimension","."]
code: def test_correctness_with_quantlib(self, dtype, use_fd):
      """Tests model with constant parameters in 1 dimension."""
      # Compare bermudan swaption price with quantlib
  
      exercise_times = [
          [0.498630137, 1.002739726],
          [1.002739726, 2.002739726],
      ]
      float_leg_start_times = [
          [
              [
                  0.498630137,
                  1.002739726,
                  1.498630137,
                  2.002739726,
                  2.498630137,
              ],
              [
                  1.002739726,
                  1.498630137,
                  2.002739726,
                  2.498630137,
                  3.002739726,
              ],
          ],
          [
              [
                  1.002739726,
                  1.498630137,
                  2.002739726,
                  2.498630137,
                  3.002739726,
              ],
              [
                  2.002739726,
                  2.498630137,
                  3.002739726,
                  3.002739726,
                  3.002739726,
              ],
          ],
      ]
      float_leg_end_times = [
          [
              [
                  1.002739726,
                  1.498630137,
                  2.002739726,
                  2.498630137,
                  3.002739726,
              ],
              [
                  1.498630137,
                  2.002739726,
                  2.498630137,
                  3.002739726,
                  3.002739726,
              ],
          ],
          [
              [
                  1.498630137,
                  2.002739726,
                  2.498630137,
                  3.002739726,
                  3.002739726,
              ],
              [
                  2.498630137,
                  3.002739726,
                  3.002739726,
                  3.002739726,
                  3.002739726,
              ],
          ],
      ]
  
      fixed_leg_payment_times = float_leg_end_times
      float_leg_daycount_fractions = np.array(
          float_leg_end_times
      ) - np.array(float_leg_start_times)
      fixed_leg_daycount_fractions = float_leg_daycount_fractions
      fixed_leg_coupon = 0.008 * np.ones_like(fixed_leg_payment_times)
  
      price_tff = tff.models.hull_white.bermudan_swaption_price(
          exercise_times=exercise_times,
          floating_leg_start_times=float_leg_start_times,
          floating_leg_end_times=float_leg_end_times,
          fixed_leg_payment_times=fixed_leg_payment_times,
          floating_leg_daycount_fractions=float_leg_daycount_fractions,
          fixed_leg_daycount_fractions=fixed_leg_daycount_fractions,
          fixed_leg_coupon=fixed_leg_coupon,
          reference_rate_fn=self.zero_rate_fn,
          notional=100.0,
          mean_reversion=self.mean_reversion_1d,
          volatility=self.volatility_1d,
          num_samples=10000,
          time_step=0.1,
          random_type=tff.math.random.RandomType.STATELESS_ANTITHETIC,
          seed=[0, 0],
          use_finite_difference=use_fd,
          time_step_finite_difference=0.05,
          num_grid_points_finite_difference=500,
          dtype=dtype,
      )
  
      # Quantlib price computed using finite difference HW using 5000 points for
      # discretization
      price_ql = [1.1016533104878343, 1.0586289990592714]
  
      self.assertAllClose(
          self.evaluate(price_tff), price_ql, rtol=1e-3, atol=1e-3
      )
  
file_path: tf-quant-finance/tf_quant_finance/models/hull_white/bermudan_swaption_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 5 for calling the HullWhiteBermudanSwaptionTest obj's underlying member method code with example usage: obj.test_correctness_with_quantlib(dtype, use_fd) without return types