code: def test_segment_cumsum_small_segment(self):
      x = tf.constant([2, 5, 1, 7] + [9] + [32, 10, 12, 3] + [4, 8, 5])
      segments = tf.constant(
          [0, 0, 0, 0] + [1] + [2, 2, 2, 2] + [3, 3, 3]
      )
      cx1 = self.evaluate(
          segment_ops.segment_cumsum(
              x, segment_ids=segments, exclusive=False
          )
      )
      np.testing.assert_array_equal(
          cx1, ([2, 7, 8, 15] + [9] + [32, 42, 54, 57] + [4, 12, 17])
      )
  
      cx2 = self.evaluate(
          segment_ops.segment_cumsum(
              x, segment_ids=segments, exclusive=True
          )
      )
      np.testing.assert_array_equal(
          cx2, ([0, 2, 7, 8] + [0] + [0, 32, 42, 54] + [0, 4, 12])
      )
  
file_path: tf-quant-finance/tf_quant_finance/math/segment_ops_test.py
imports: import numpy
  import tensorflow.compat.v2
  from tensorflow.python.framework import test_util
  from tf_quant_finance.math import segment_ops
label_desc: Use image node_id 11 for calling the SegmentOpsTest obj's underlying member method code with example usage: obj.test_segment_cumsum_small_segment() without return types