code: def test_correctness(self, dtype):
      mats = [1.0, 2.0, 3.0, 5.0, 7.0, 10.0, 30.0]
      par_swap_rates = [2.855, 3.097, 3.134, 3.152, 3.181, 3.23, 3.27]
      float_leg_start_times = [
          np.arange(0.0, x, 0.25, dtype) for x in mats
      ]
  
      float_leg_end_times = [
          tf.convert_to_tensor(np.arange(0.25, x + 0.1, 0.25, dtype))
          for x in mats
      ]
  
      float_leg_dc = [
          np.array(np.repeat(0.25, len(x)), dtype=dtype)
          for x in float_leg_start_times
      ]
  
      fixed_leg_start_times = [
          np.arange(0.0, x, 0.5, dtype) for x in mats
      ]
  
      fixed_leg_end_times = [
          np.arange(0.5, x + 0.1, 0.5, dtype) for x in mats
      ]
  
      fixed_leg_dc = [
          np.array(np.repeat(0.5, len(x)), dtype=dtype)
          for x in fixed_leg_start_times
      ]
  
      fixed_leg_cashflows = [
          np.array(np.repeat(-y / 100.0, len(x)), dtype=dtype)
          for x, y in zip(fixed_leg_start_times, par_swap_rates)
      ]
  
      pvs = np.array(np.repeat(0.0, len(mats)), dtype=dtype)
  
      initial_curve_rates = np.array(
          np.repeat(0.01, len(mats)), dtype=dtype
      )
  
      results = self.evaluate(
          tff.rates.swap_curve_fit(
              float_leg_start_times,
              float_leg_end_times,
              float_leg_dc,
              fixed_leg_start_times,
              fixed_leg_end_times,
              fixed_leg_cashflows,
              fixed_leg_dc,
              pvs,
              dtype=dtype,
              curve_tolerance=1e-5,
              initial_curve_rates=initial_curve_rates,
          )
      )
  
      np.testing.assert_allclose(
          results.times, [1.0, 2.0, 3.0, 5.0, 7.0, 10.0, 30.0]
      )
      self.assertFalse(results.failed)
      expected_discount_rates = np.array(
          [
              0.02834814,
              0.03077457,
              0.03113739,
              0.03130794,
              0.03160892,
              0.03213901,
              0.03257991,
          ],
          dtype=dtype,
      )
      np.testing.assert_allclose(
          results.rates, expected_discount_rates, atol=1e-5
      )
  
file_path: tf-quant-finance/tf_quant_finance/rates/swap_curve_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 1 for calling the SwapCurveTest obj's underlying member method code with example usage: obj.test_correctness(dtype) without return types