code: def remix(input, axis, indices, name=None):
      """
      Remix the audio from segments indices.
  
      Args:
        input: An audio Tensor.
        axis: The axis to trim.
        indices: The indices of `start, stop` of each segments.
        name: A name for the operation (optional).
      Returns:
        A tensor of remixed audio.
      """
      shape = tf.shape(indices, out_type=tf.int64)
  
      rank = tf.cast(tf.rank(indices), tf.int64)
      mask = tf.math.equal(tf.range(rank), axis + 1)
  
      start = tf.slice(
          indices,
          tf.where(mask, tf.cast(0, tf.int64), 0),
          tf.where(mask, tf.cast(1, tf.int64), shape),
      )
      stop = tf.slice(
          indices,
          tf.where(mask, tf.cast(1, tf.int64), 0),
          tf.where(mask, tf.cast(1, tf.int64), shape),
      )
  
      start = tf.squeeze(start, axis=[axis + 1])
      stop = tf.squeeze(stop, axis=[axis + 1])
  
      start = tf.expand_dims(start, axis=axis)
      stop = tf.expand_dims(stop, axis=axis)
  
      shape = tf.shape(input, out_type=tf.int64)
      length = shape[axis]
  
      rank = tf.cast(tf.rank(input), tf.int64)
      indices = tf.range(length, dtype=tf.int64)
      indices = tf.reshape(
          indices,
          tf.where(tf.math.equal(tf.range(rank), axis), length, 1),
      )
      indices = tf.broadcast_to(indices, shape)
  
      indices = tf.expand_dims(indices, axis=axis + 1)
  
      mask = tf.math.logical_and(
          tf.math.greater_equal(indices, start),
          tf.math.less(indices, stop),
      )
  
      mask = tf.reduce_any(mask, axis=axis + 1)
  
      # count bool to adjust padding
      count = tf.reduce_sum(
          tf.cast(mask, tf.int64), axis=axis, keepdims=True
      )
  
      # length after padding
      length = tf.reduce_max(count)
  
      # delta
      delta = count - tf.reduce_min(count)
      padding = tf.range(
          tf.constant(1, tf.int64), tf.reduce_max(delta) + 1
      )
      padding = tf.reshape(
          padding,
          tf.where(
              tf.math.equal(tf.range(rank), axis),
              tf.reduce_max(delta),
              1,
          ),
      )
      padding = tf.broadcast_to(
          padding,
          tf.where(
              tf.math.equal(tf.range(rank), axis),
              tf.reduce_max(delta),
              shape,
          ),
      )
      padding = tf.math.greater(padding, delta)
  
      mask = tf.concat([mask, padding], axis=axis)
      input = tf.concat(
          [input, tf.zeros(tf.shape(padding), input.dtype)], axis=axis
      )
      result = tf.boolean_mask(input, mask)
      result = tf.reshape(
          result,
          tf.where(tf.math.equal(tf.range(rank), axis), length, shape),
      )
  
      return result
  
imports: import sys
  import tensorflow
  from tensorflow_io.python.ops import core_ops
label_desc: Use image node_id 5 for calling a global function with example usage: remix(input, axis, indices, name) and returns: result