class_docstr: Tests for methods in linear_interpolation module.
docstr: Tests linear interpolation with const extrapolation.
docstr_tok: ["Tests","linear","interpolation","with","const","extrapolation","."]
code: def test_linear_interpolation_const_extrapolation(
      self, optimize_for_tpu
  ):
      """Tests linear interpolation with const extrapolation."""
      x = [-10, -1, 1, 3, 6, 7, 8, 15, 18, 25, 30, 35]
      x_data = [-1, 2, 6, 8, 18, 30]
      y_data = [10, -1, -5, 7, 9, 20]
      result = self.evaluate(
          tff.math.interpolation.linear.interpolate(
              x,
              x_data,
              y_data,
              optimize_for_tpu=optimize_for_tpu,
              dtype=tf.float32,
          )
      )
      self.assertAllClose(
          result,
          [np.interp(x_coord, x_data, y_data) for x_coord in x],
          1e-8,
      )
      self.assertIsInstance(result[0], np.float32)
  
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 2 for calling the LinearInterpolation obj's underlying member method code with example usage: obj.test_linear_interpolation_const_extrapolation(optimize_for_tpu) without return types