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_vector_valued_interpolation_with_1_batch_dim_batch_minmax(
      self,
  ):
      # implied_x_ref.shape = [2, 200], with the 2 batch members having different
      # min/max (hence, "batch minmax").
      # The first batch member will be used for exponentials,
      # The second batch member will be used for logs.
      implied_x_ref = np.stack(  # Shape [2, 200]
          [np.linspace(-1.0, 2, 200), np.linspace(1.0, 3.0, 200)],
          axis=0,
      )
      y_exp = np.stack(  # Shape [200, 2]
          [np.exp(implied_x_ref[0]), np.exp(2 * implied_x_ref[0])],
          axis=-1,
      )
      y_log = np.stack(  # Shape [200, 2]
          [np.log(implied_x_ref[1]), np.log(2 * implied_x_ref[1])],
          axis=-1,
      )
      y_ref = np.stack([y_exp, y_log], axis=0)  # Shape [2, 200, 2]
  
      x = np.stack(  # Shape [2, 3]
          [[-0.5, 0.0, 1.0], [1.12, 2.34, 2.5]], axis=0
      )
      # Interpolate along axis 1, the axis with 200 elements.
      y = interpolation.batch_interp_regular_1d_grid(
          x,
          x_ref_min=[-1.0, 1],
          x_ref_max=[2.0, 3.0],
          y_ref=y_ref,
          axis=1,
      )
      self.assertAllEqual((2, 3, 2), y.shape)
      y_ = self.evaluate(y)
      expected_y_exp = np.stack(  # Shape [3, 2]
          [np.exp(x[0]), np.exp(2 * x[0])], axis=-1
      )
      expected_y_log = np.stack(  # Shape [3, 2]
          [np.log(x[1]), np.log(2 * x[1])], axis=-1
      )
      expected_y = np.stack(  # Shape [2, 3, 2]
          [expected_y_exp, expected_y_log], axis=0
      )
      self.assertAllClose(y_, expected_y, 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 12 for calling the BatchInterpRegular1DGridTest obj's underlying member method code with example usage: obj.test_vector_valued_interpolation_with_1_batch_dim_batch_minmax() without return types