class_docstr: Test for tfp.math.interp_regular_1d_grid.
class_docstr_tok: ["Test","for","tfp.math.interp_regular_1d_grid","."]
code: def test_matrix_interpolation(self):
      # Interpolate a matrix-valued function of one variable.
      # Use only two interpolation points.
      mat_0 = np.array([[1.0, 0.0], [0.0, 1.0]])
      mat_1 = np.array([[0.0, -1], [1, 0]])
      y_ref = np.array([mat_0, mat_1])
  
      # Get three output matrices at once.
      x = np.array([0.0, 0.5, 1.0])
      y = interpolation.interp_regular_1d_grid(
          x, x_ref_min=0.0, x_ref_max=1.0, y_ref=y_ref, axis=0
      )
      self.assertAllEqual((3, 2, 2), y.shape)
      y_ = self.evaluate(y)
      self.assertAllClose(y_[0], mat_0)
      self.assertAllClose(y_[1], 0.5 * mat_0 + 0.5 * mat_1)
      self.assertAllClose(y_[2], mat_1)
  
      # Get one single output matrix
      y_0p5 = interpolation.interp_regular_1d_grid(
          x=0.5, x_ref_min=0.0, x_ref_max=1.0, y_ref=y_ref, axis=0
      )
      self.assertAllClose(
          self.evaluate(y_0p5), 0.5 * mat_0 + 0.5 * mat_1
      )
  
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 InterpRegular1DGridTest obj's underlying member method code with example usage: obj.test_matrix_interpolation() without return types