code: def broadcast_to(tensor, shape):
      """Broadcast an tensor to a new shape.
  
      Parameters
      ----------
      tensor : array_like
          The tensor to broadcast.
      shape : tuple
          The shape of the desired array.
  
      Returns
      -------
      broadcast : Tensor
  
      Raises
      ------
      ValueError
          If the tensor is not compatible with the new shape according to Mars's
          broadcasting rules.
  
      Examples
      --------
      >>> import mars.tensor as mt
  
      >>> x = mt.array([1, 2, 3])
      >>> mt.broadcast_to(x, (3, 3)).execute()
      array([[1, 2, 3],
             [1, 2, 3],
             [1, 2, 3]])
      """
      from ..core import Tensor
  
      tensor = (
          tensor if isinstance(tensor, Tensor) else astensor(tensor)
      )
      shape = (
          tuple(shape) if isinstance(shape, (list, tuple)) else (shape,)
      )
  
      if any(np.isnan(s) for s in tensor.shape):
          raise ValueError(
              "input tensor has unknown shape, need to call `.execute()` first"
          )
  
      if tensor.shape == shape:
          return tensor
  
      new_ndim = len(shape) - tensor.ndim
      if new_ndim < 0:
          raise ValueError(
              "input operand has more dimensions than allowed by the axis remapping"
          )
      if any(
          o != n
          for o, n in zip(tensor.shape, shape[new_ndim:])
          if o != 1
      ):
          raise ValueError(
              "operands could not be broadcast together "
              f"with remapped shapes [original->remapped]: {tensor.shape} "
              f"and requested shape {shape}"
          )
  
      op = TensorBroadcastTo(
          shape, dtype=tensor.dtype, sparse=tensor.issparse()
      )
      return op(tensor, shape)
  
file_path: mars/mars/tensor/base/broadcast_to.py
imports: import numpy
  from ...None import opcodes
  from ...serialization.serializables import KeyField, TupleField
  from ..operands import TensorHasInput, TensorOperandMixin
  from ..datasource import tensor
  from ..array_utils import get_array_module, device
label_desc: Use image node_id 1 for calling a global function with example usage: broadcast_to(tensor, shape) and returns: op, tensor