docstr: Tests a spline where there are x_points of the same value.
docstr_tok: ["Tests","a","spline","where","there","are","x_points","of","the","same","value","."]
code: def test_duplicate_x_points_batching(
      self, optimize_for_tpu, boundary_condition_type
  ):
      """Tests a spline where there are x_points of the same value."""
      # Repeated right boundary values are allowed
      x_data = np.array(
          [
              [1.0, 2.0, 3.0, 4.0, 4.0, 4.0, 4.0],
              [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0],
          ]
      )
      y_data = np.array(
          [
              [3.0, 1.0, 3.0, 2.0, 2.0, 2.0, 2.0],
              [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0],
          ]
      )
      expected_left_boundary_derivative = 12.0 * x_data[..., -1:]
      expected_right_boundary_derivative = 34.0 * x_data[..., -1:]
      spline = self.build_spline(
          x_data,
          y_data,
          boundary_condition_type,
          np.float64,
          expected_left_boundary_derivative,
          expected_right_boundary_derivative,
      )
  
      x_values = np.array(
          [
              [0.0, 1.0, 1.5, 2.0, 2.5, 3.5, 4.0, 5.0],
              [0.0, 1.0, 1.5, 2.0, 2.5, 3.5, 4.0, 5.0],
          ]
      )
      interpolated = tff.math.interpolation.cubic.interpolate(
          x_values, spline, optimize_for_tpu=optimize_for_tpu
      )
      expected = np.array(
          [
              [3.0, 3.0, 2.025, 1.0, 1.875, 2.6, 2.0, 2.0],
              [
                  1.0,
                  1.0,
                  1.34134615,
                  2.0,
                  2.54326923,
                  3.48557692,
                  4.0,
                  5.0,
              ],
          ]
      )
      if (
          boundary_condition_type
          == cubic.BoundaryConditionType.FIXED_FIRST_DERIVATIVE
      ):
          expected = np.array(
              [
                  [
                      3.0,
                      3.0,
                      8.49166667,
                      1.0,
                      5.54166667,
                      -18.53333333,
                      2.0,
                      2.0,
                  ],
                  [
                      1.0,
                      1.0,
                      14.69294872,
                      2.0,
                      -1.21474359,
                      5.16602564,
                      4.0,
                      5.0,
                  ],
              ]
          )
      interpolated = self.evaluate(interpolated)
      np.testing.assert_almost_equal(expected, interpolated)
  
imports: from absl.testing import parameterized
  import numpy
  import tensorflow.compat.v2
  import tensorflow_probability
  import tf_quant_finance
  from tensorflow.python.framework import test_util
  from tf_quant_finance.math.interpolation import cubic
label_desc: Use image node_id 4 for calling the CubicInterpolationTest obj's underlying member method code with example usage: obj.test_duplicate_x_points_batching(optimize_for_tpu, boundary_condition_type) without return types