code: def eye(
      N,
      M=None,
      k=0,
      dtype=None,
      sparse=False,
      gpu=None,
      chunk_size=None,
      order="C",
  ):
      """
      Return a 2-D tensor with ones on the diagonal and zeros elsewhere.
  
      Parameters
      ----------
      N : int
        Number of rows in the output.
      M : int, optional
        Number of columns in the output. If None, defaults to `N`.
      k : int, optional
        Index of the diagonal: 0 (the default) refers to the main diagonal,
        a positive value refers to an upper diagonal, and a negative value
        to a lower diagonal.
      dtype : data-type, optional
        Data-type of the returned tensor.
      sparse: bool, optional
          Create sparse tensor if True, False as default
      gpu : bool, optional
          Allocate the tensor on GPU if True, False as default
      chunk_size : int or tuple of int or tuple of ints, optional
          Desired chunk size on each dimension
      order : {'C', 'F'}, optional
          Whether the output should be stored in row-major (C-style) or
          column-major (Fortran-style) order in memory.
  
      Returns
      -------
      I : Tensor of shape (N,M)
        An tensor where all elements are equal to zero, except for the `k`-th
        diagonal, whose values are equal to one.
  
      See Also
      --------
      identity : (almost) equivalent function
      diag : diagonal 2-D tensor from a 1-D tensor specified by the user.
  
      Examples
      --------
      >>> import mars.tensor as mt
  
      >>> mt.eye(2, dtype=int).execute()
      array([[1, 0],
             [0, 1]])
      >>> mt.eye(3, k=1).execute()
      array([[ 0.,  1.,  0.],
             [ 0.,  0.,  1.],
             [ 0.,  0.,  0.]])
  
      """
      if M is None:
          M = N
  
      shape = (N, M)
      tensor_order = get_order(
          order,
          None,
          available_options="CF",
          err_msg="only 'C' or 'F' order is permitted",
      )
      op = TensorEye(
          k, dtype=dtype, gpu=gpu, sparse=sparse, order=order
      )
      return op(shape, chunk_size=chunk_size, order=tensor_order)
  
file_path: mars/mars/tensor/datasource/eye.py
imports: import numpy
  from ...None import opcodes
  from ...serialization.serializables import Int32Field, StringField
  from ...config import options
  from ..utils import decide_chunk_sizes, get_order
  from .diag import TensorDiagBase
  from .core import TensorNoInput
  from ...lib import sparse
  from ..array_utils import create_array
label_desc: Use image node_id 1 for calling a global function with example usage: eye(N, M, k, dtype, sparse, gpu, chunk_size, order) and returns: op