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_scalar_valued_interpolation_with_1_batch_dim(self):
      # First batch member is an exponential function, second is a log.
      implied_x_ref = [
          tf.linspace(-3.0, 3.2, 200),
          tf.linspace(0.5, 3.0, 200),
      ]
      y_ref = tf.stack(  # Shape [2, 200]
          [tf.exp(implied_x_ref[0]), tf.math.log(implied_x_ref[1])],
          axis=0,
      )
  
      x = [
          [
              -1.0,
              1.0,
              0.0,
          ],  # Shape [2, 3].  Batch=2, 3 values per batch.
          [1.0, 2.0, 3.0],
      ]
      y = interpolation.batch_interp_regular_1d_grid(
          x,
          x_ref_min=[-3.0, 0.5],
          x_ref_max=[3.2, 3.0],
          y_ref=y_ref,
          axis=-1,
      )
      self.assertAllEqual((2, 3), y.shape)
      y_ = self.evaluate(y)
      self.assertAllClose(np.exp(x[0]), y_[0], rtol=1e-3)
      self.assertAllClose(np.log(x[1]), y_[1], rtol=1e-3, atol=1e-3)
  
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 7 for calling the BatchInterpRegular1DGridTest obj's underlying member method code with example usage: obj.test_scalar_valued_interpolation_with_1_batch_dim() without return types