code: def segment_reduce_real(op, x, offsets):
      y, arg = _segment_reduce(op, x, offsets)
  
      def segment_reduce_backward(dy):
          m = x.shape[0]
          if op == "sum":
              offsets_np = asnumpy(offsets[1:])
              indices_np = np.zeros((m + 1,), dtype=offsets_np.dtype)
              np.add.at(
                  indices_np, offsets_np, np.ones_like(offsets_np)
              )
              indices_np = np.cumsum(indices_np, -1)[:-1]
              indices = zerocopy_from_numpy(indices_np)
              dx = tf.gather(dy, indices)
          else:
              dx = _bwd_segment_cmp(dy, arg, m)
          return dx
  
      return y, segment_reduce_backward
  
imports: import numpy
  import tensorflow
  from ..._sparse_ops import _bwd_segment_cmp, _csrmask, _csrmm, _csrsum, _gsddmm, _gspmm, _scatter_add, _segment_reduce
  from ...base import ALL, is_all
  from ...heterograph_index import create_unitgraph_from_csr
  from .tensor import asnumpy, context, copy_to, tensor, zerocopy_from_numpy
label_desc: Use image node_id 14 for calling a global function with example usage: segment_reduce_real(op, x, offsets) and returns: y,  segment_reduce_backward, dx