code: def repeat(a, repeats, axis=None):
      """
      Repeat elements of a tensor.
  
      Parameters
      ----------
      a : array_like
          Input tensor.
      repeats : int or tensor of ints
          The number of repetitions for each element.  `repeats` is broadcasted
          to fit the shape of the given axis.
      axis : int, optional
          The axis along which to repeat values.  By default, use the
          flattened input tensor, and return a flat output tensor.
  
      Returns
      -------
      repeated_tensor : Tensor
          Output array which has the same shape as `a`, except along
          the given axis.
  
      See Also
      --------
      tile : Tile a tensor.
  
      Examples
      --------
      >>> import mars.tensor as mt
  
      >>> mt.repeat(3, 4).execute()
      array([3, 3, 3, 3])
      >>> x = mt.array([[1,2],[3,4]])
      >>> mt.repeat(x, 2).execute()
      array([1, 1, 2, 2, 3, 3, 4, 4])
      >>> mt.repeat(x, 3, axis=1).execute()
      array([[1, 1, 1, 2, 2, 2],
             [3, 3, 3, 4, 4, 4]])
      >>> mt.repeat(x, [1, 2], axis=0).execute()
      array([[1, 2],
             [3, 4],
             [3, 4]])
  
      """
      op = TensorRepeat(axis=axis)
      return op(a, repeats)
  
imports: import itertools
  from numbers import Integral
  import numpy
  from ...None import opcodes
  from ...core import recursive_tile
  from ...serialization.serializables import KeyField, AnyField, Int32Field
  from ...utils import has_unknown_shape
  from ..core import Tensor, TENSOR_TYPE, TENSOR_CHUNK_TYPE, TensorOrder
  from ..utils import broadcast_shape, unify_chunks
  from ..operands import TensorHasInput, TensorOperandMixin
  from ..datasource import tensor
  from ..array_utils import as_same_device, device
  from .ravel import ravel
label_desc: Use image node_id 1 for calling a global function with example usage: repeat(a, repeats, axis) and returns: op