code: def _rowwise_unsorted_segment_sum(values, indices, n):
      """UnsortedSegmentSum on each row.
  
      Args:
        values: a `Tensor` with shape `[batch_size, k]`.
        indices: an integer `Tensor` with shape `[batch_size, k]`.
        n: an integer.
      Returns:
        A `Tensor` with the same type as `values` and shape `[batch_size, n]`.
      """
      batch, k = tf.unstack(tf.shape(indices), num=2)
      indices_flat = (
          tf.reshape(indices, [-1]) + tf.div(tf.range(batch * k), k) * n
      )
      ret_flat = tf.unsorted_segment_sum(
          tf.reshape(values, [-1]), indices_flat, batch * n
      )
      return tf.reshape(ret_flat, [batch, n])
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import functools
  import math
  import six
  from six.moves import range
  from six.moves import zip
  from tensor2tensor.layers import common_layers
  from tensor2tensor.layers.vq_discrete import DiscreteBottleneck
  import tensorflow.compat.v1
label_desc: Use image node_id 5 for calling a global function with example usage: _rowwise_unsorted_segment_sum(values, indices, n) and returns: tf