class_docstr: Test for 1-D usage of tfp.math.interp_regular_1d_grid.
class_docstr_tok: ["Test","for","1-D","usage","of","tfp.math.interp_regular_1d_grid","."]
code: def test_on_1d_array_nan_fill_value(self):
      x_min = 0.0
      x_max = 1.0
      dtype = np.float32
      num_pts = 4
  
      implied_x_ref = np.linspace(x_min, x_max, num_pts, dtype=dtype)
      y_ref = 2 * implied_x_ref
  
      # First and last values of x are outside the [x_min, x_max] range.
      x = np.array([-1.0, 0.1, 0.2, 0.4, 2.0]).astype(dtype)
      y_expected = 2 * x
      y_expected[0] = np.nan  # Will fill this value for points < x_min.
      y_expected[
          -1
      ] = np.nan  # Will fill this value for points > x_max.
  
      y = interpolation.batch_interp_regular_1d_grid(
          x, x_min, x_max, y_ref, fill_value=np.nan
      )
      self.assertAllEqual(y_expected.shape, y.shape)
      y_ = self.evaluate(y)
      self.assertAllClose(y_, y_expected, atol=0, rtol=1e-6)
  
imports: import numpy
  from scipy import interpolate
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.math import gradient
  from tensorflow_probability.python.math import interpolation
label_desc: Use image node_id 2 for calling the BatchInterpRegular1DGridTest obj's underlying member method code with example usage: obj.test_on_1d_array_nan_fill_value() without return types