class_docstr: Tests for methods in piecewise module.
class_docstr_tok: ["Tests","for","methods","in","piecewise","module","."]
docstr: Tests that `values` event shape is `jump_locations` event shape + 1.
docstr_tok: ["Tests","that","`","values","`","event","shape","is","`","jump_locations","`","event","shape","+","1","."]
code: def test_matrix_event_shape_no_batch_shape(self, dtype):
      """Tests that `values` event shape is `jump_locations` event shape + 1."""
      x = np.array([0.0, 0.1, 2.0, 11.0])
      jump_locations = [0.1, 10]
      values = [[[1, 2], [3, 4]], [[5, 6], [7, 8]], [[9, 10], [11, 12]]]
      piecewise_func = piecewise.PiecewiseConstantFunc(
          jump_locations, values, dtype=dtype
      )
      value = piecewise_func(x)
      integral = piecewise_func.integrate(x, x + 1)
      expected_value = [
          [[1, 2], [3, 4]],
          [[1, 2], [3, 4]],
          [[5, 6], [7, 8]],
          [[9, 10], [11, 12]],
      ]
      expected_integral = [
          [[4.6, 5.6], [6.6, 7.6]],
          [[5, 6], [7, 8]],
          [[5, 6], [7, 8]],
          [[9, 10], [11, 12]],
      ]
      if dtype is None:
          with self.subTest("Dtype"):
              # Dtype of jump_locations and of  piecewise_func should match
              self.assertEqual(piecewise_func.dtype(), tf.float32)
      else:
          with self.subTest("Dtype"):
              self.assertEqual(dtype, piecewise_func.dtype())
      with self.subTest("Values"):
          self.assertAllClose(
              value, expected_value, atol=1e-5, rtol=1e-5
          )
      with self.subTest("Integrals"):
          self.assertAllClose(
              integral, expected_integral, atol=1e-5, rtol=1e-5
          )
  
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 12 for calling the Piecewise obj's underlying member method code with example usage: obj.test_matrix_event_shape_no_batch_shape(dtype) without return types