code: def test_1d_linear_interpolation():
      """For 1d linear interpolation, we can compare directly to scipy."""
      tp = _QuadraticPlusSinProblem1D()
      (query_points, _, train_points, train_values) = tp.get_problem(
          extrapolate=False, dtype="float64"
      )
      interpolation_order = 1
  
      with tf.name_scope("interpolator"):
          interp = interpolate_spline(
              train_points,
              train_values,
              query_points,
              interpolation_order,
          ).numpy()
  
          # Just look at the first element of the minibatch.
          # Also, trim the final singleton dimension.
          interp = interp[0, :, 0]
          query_points = query_points.numpy()[0, :, 0]
          train_points = train_points.numpy()[0, :, 0]
          train_values = train_values.numpy()[0, :, 0]
  
          # Compute scipy interpolation.
          scipy_interp_function = sc_interpolate.interp1d(
              train_points, train_values, kind="linear"
          )
  
          scipy_interpolation = scipy_interp_function(query_points)
          scipy_interpolation_on_train = scipy_interp_function(
              train_points
          )
  
          # Even with float64 precision, the interpolants disagree with scipy a
          # bit due to the fact that we add the EPSILON to prevent sqrt(0), etc.
          tol = 1e-3
  
          np.testing.assert_allclose(
              train_values,
              scipy_interpolation_on_train,
              atol=tol,
              rtol=tol,
          )
          np.testing.assert_allclose(
              interp, scipy_interpolation, atol=tol, rtol=tol
          )
  
file_path: addons/tensorflow_addons/image/tests/interpolate_spline_test.py
imports: import numpy
  import pytest
  from scipy import interpolate
  import tensorflow
  from tensorflow_addons.image import interpolate_spline
label_desc: Use image node_id 1 for calling a global function with example usage: test_1d_linear_interpolation() without return types