class_docstr: Tests for methods in piecewise module.
class_docstr_tok: ["Tests","for","methods","in","piecewise","module","."]
docstr: Tests PiecewiseConstantFunc with batching and repetitive values.
docstr_tok: ["Tests","PiecewiseConstantFunc","with","batching","and","repetitive","values","."]
code: def test_piecewise_constant_value_with_batch_and_repetitions(
      self, dtype
  ):
      """Tests PiecewiseConstantFunc with batching and repetitive values."""
      x = tf.constant(
          [
              [-4.1, 0.1, 1.0, 2.0, 10, 11.0],
              [1.0, 2.0, 3.0, 2.0, 5.0, 9.0],
          ],
          dtype=dtype,
      )
      jump_locations = tf.constant(
          [
              [0.1, 0.1, 1.0, 1.0, 10.0, 10.0],
              [-1.0, 1.2, 2.2, 2.2, 2.2, 8.0],
          ],
          dtype=dtype,
      )
      values = tf.constant(
          [[3, 3, 4, 5, 5.0, 2, 6.0], [-1, -5, 2, 5, 5.0, 5.0, 1.0]],
          dtype=dtype,
      )
      piecewise_func = piecewise.PiecewiseConstantFunc(
          jump_locations, values, dtype=dtype
      )
      # Also verifies left-continuity
      value = piecewise_func(x, left_continuous=True)
      if dtype is None:
          with self.subTest("Dtype"):
              self.assertEqual(value.dtype, jump_locations.dtype)
      else:
          with self.subTest("Dtype"):
              self.assertEqual(value.dtype, dtype)
      expected_value = np.array(
          [
              [3.0, 3.0, 4.0, 5.0, 5.0, 6.0],
              [-5.0, 2.0, 5.0, 2.0, 5.0, 1.0],
          ]
      )
      with self.subTest("DtyValue"):
          self.assertAllEqual(value, expected_value)
  
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 8 for calling the Piecewise obj's underlying member method code with example usage: obj.test_piecewise_constant_value_with_batch_and_repetitions(dtype) without return types