docstr: Tests 2-factor correlated model with constant vol.
docstr_tok: ["Tests","2-factor","correlated","model","with","constant","vol","."]
code: def test_correctness_2_factor_with_correlation(self, dtype):
      """Tests 2-factor correlated model with constant vol."""
      num_samples = 100000
  
      def discount_fn(x):
          return 0.01 * tf.ones_like(
              x, dtype=dtype
          )  # pylint: disable=cell-var-from-loop
  
      process = tff.models.hjm.QuasiGaussianHJM(
          dim=2,
          mean_reversion=self.mean_reversion_4_factor[:2],
          volatility=self.volatility_4_factor[:2],
          corr_matrix=[[1.0, 0.5], [0.5, 1.0]],
          initial_discount_rate_fn=discount_fn,
          dtype=dtype,
      )
      times = np.array([0.1, 1.0, 2.0, 3.0])
      _, discount_paths, _, _ = process.sample_paths(
          times,
          num_samples=num_samples,
          time_step=0.1,
          random_type=tff.math.random.RandomType.STATELESS_ANTITHETIC,
          seed=[1, 2],
          skip=1000000,
      )
      self.assertEqual(discount_paths.dtype, dtype)
      discount_paths = self.evaluate(discount_paths)
      self.assertAllEqual(discount_paths.shape, [num_samples, 4])
      discount_mean = np.mean(discount_paths, axis=0)
      expected_mean = np.exp(-0.01 * times)
      self.assertAllClose(
          discount_mean, expected_mean, rtol=1e-4, atol=1e-4
      )
  
file_path: tf-quant-finance/tf_quant_finance/models/hjm/quasi_gaussian_hjm_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 9 for calling the HJMModelTest obj's underlying member method code with example usage: obj.test_correctness_2_factor_with_correlation(dtype) and returns: unknown