code: def repeat(x, repeats):
      """
      Repeats elements of a Tensor (equivalent to np.repeat, but only for 1D
      tensors).
      :param x: rank 1 Tensor;
      :param repeats: rank 1 Tensor with same shape as x, the number of
      repetitions for each element;
      :return: rank 1 Tensor, of shape `(sum(repeats), )`.
      """
      x = tf.expand_dims(x, 1)
      max_repeats = tf.reduce_max(repeats)
      tile_repeats = [1, max_repeats]
      arr_tiled = tf.tile(x, tile_repeats)
      mask = tf.less(tf.range(max_repeats), tf.expand_dims(repeats, 1))
      result = tf.reshape(tf.boolean_mask(arr_tiled, mask), [-1])
      return result
  
imports: import numpy
  import tensorflow
  from tensorflow.keras import backend
label_desc: Use image node_id 3 for calling a global function with example usage: repeat(x, repeats) and returns: result