docstr: Tests calibration with constant parameters is XLA-compatible.
code: def test_calibration(
      self,
      optimizer_fn,
      vol_based_calib,
      num_hjm_factors,
      time_step,
      num_time_steps,
      use_xla,
      use_fd,
      max_iter,
  ):
      """Tests calibration with constant parameters is XLA-compatible."""
      dtype = tf.float64
      mr0 = [0.01, 0.05]
      if num_hjm_factors == 1:
          mr0 = [0.01]
  
      vol0 = [0.005, 0.007]
      if num_hjm_factors == 1:
          vol0 = [0.002]
  
      zero_rate_fn = lambda x: 0.01 * tf.ones_like(x, dtype=dtype)
  
      times = np.unique(np.reshape(self.expiries, [-1]))
      curve_times = np.unique(
          np.reshape(
              self.fixed_leg_payment_times
              - np.expand_dims(self.expiries, axis=-1),
              [-1],
          )
      )
      random_type = None
      seed = 0
      num_samples = 200
  
      valuation_method = (
          tff.models.ValuationMethod.FINITE_DIFFERENCE
          if use_fd
          else tff.models.ValuationMethod.MONTE_CARLO
      )
  
      @tf.function(experimental_compile=True)
      def _fn():
          (
              (calib_mr, calib_vol, calib_corr),
              _,
              _,
          ) = tff.models.hjm.calibration_from_swaptions(
              prices=self.prices,
              expiries=self.expiries,
              floating_leg_start_times=self.float_leg_start_times,
              floating_leg_end_times=self.float_leg_end_times,
              fixed_leg_payment_times=self.fixed_leg_payment_times,
              floating_leg_daycount_fractions=self.float_leg_daycount_fractions,
              fixed_leg_daycount_fractions=self.fixed_leg_daycount_fractions,
              fixed_leg_coupon=self.fixed_leg_coupon,
              reference_rate_fn=zero_rate_fn,
              notional=100.0,
              num_hjm_factors=num_hjm_factors,
              mean_reversion=mr0,
              volatility=vol0,
              optimizer_fn=optimizer_fn,
              volatility_based_calibration=vol_based_calib,
              swaption_valuation_method=valuation_method,
              num_samples=num_samples,
              random_type=random_type,
              seed=seed,
              time_step=time_step,
              num_time_steps=num_time_steps,
              times=times,
              curve_times=curve_times,
              time_step_finite_difference=time_step,
              num_grid_points_finite_difference=41,
              maximum_iterations=max_iter,
              dtype=dtype,
          )
          return calib_mr, calib_vol, calib_corr
  
      # Extracting HLO text is supported only in eager mode
      hlo_text = _fn.experimental_get_compiler_ir()(stage="hlo")
  
      # Check that the output has an expected format
      self.assertStartsWith(hlo_text, "HloModule")
  
file_path: tf-quant-finance/tf_quant_finance/models/hjm/calibration_xla_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 2 for calling the HJMCalibrationTest obj's underlying member method code with example usage: obj.test_calibration(optimizer_fn, vol_based_calib, num_hjm_factors, time_step, num_time_steps, use_xla, use_fd, max_iter) and returns: calib_mr,  calib_vol,  calib_corr