code: def test_segment_diffs_segment_exclusive(self):
      x = tf.constant([2, 5, 1, 7, 9] + [32, 10, 12, 3] + [4, 8, 5])
      segments = tf.constant([0, 0, 0, 0, 0] + [1, 1, 1, 1] + [2, 2, 2])
      dx1 = self.evaluate(
          segment_ops.segment_diff(
              x, segment_ids=segments, order=1, exclusive=True
          )
      )
      np.testing.assert_array_equal(
          dx1, ([3, -4, 6, 2] + [-22, 2, -9] + [4, -3])
      )
  
      dx2 = self.evaluate(
          segment_ops.segment_diff(
              x, segment_ids=segments, order=2, exclusive=True
          )
      )
      np.testing.assert_array_equal(dx2, ([-1, 2, 8] + [-20, -7] + [1]))
  
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 3 for calling the SegmentOpsTest obj's underlying member method code with example usage: obj.test_segment_diffs_segment_exclusive() without return types