docstr: Test the deviation of the interpolated values from the actual.
docstr_tok: ["Test","the","deviation","of","the","interpolated","values","from","the","actual","."]
code: def test_error_calc(self, optimize_for_tpu):
      """Test the deviation of the interpolated values from the actual."""
      sampling_points = 1000
      spline_x = np.linspace(0.0, 10.0, num=11, dtype=np.float64)
      spline_y = [1.0 / (1.0 + x * x) for x in spline_x]
      x_series = np.array([spline_x])
      y_series = np.array([spline_y])
      spline = tff.math.interpolation.cubic.build_spline(
          x_series, y_series
      )
  
      # There is an error if we go to 10.0
      test_range_x = np.linspace(
          0.0, 9.99, num=sampling_points, dtype=np.float64
      )
      search_args = tf.constant(
          np.array([test_range_x]), dtype=tf.float64
      )
      projected_y = tff.math.interpolation.cubic.interpolate(
          search_args, spline, optimize_for_tpu=optimize_for_tpu
      )
      expected_y = tf.constant(
          [[1.0 / (1.0 + x * x) for x in test_range_x]],
          dtype=tf.float64,
      )
      errors = expected_y - projected_y
      deviation = self.evaluate(
          tfp.stats.stddev(errors[0], sample_axis=0)
      )
      limit = 0.02
      self.assertLess(deviation, limit)
  
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 5 for calling the CubicInterpolationTest obj's underlying member method code with example usage: obj.test_error_calc(optimize_for_tpu) without return types