code: def eye(
      n_rows: int,
      n_cols: Optional[int] = None,
      /,
      *,
      k: int = 0,
      batch_shape: Optional[Union[int, Sequence[int]]] = None,
      dtype: Optional[Union[ivy.Dtype, ivy.NativeDtype]] = None,
      device: Optional[Union[ivy.Device, ivy.NativeDevice]] = None,
      out: Optional[ivy.Array] = None,
  ) -> ivy.Array:
      """Return a two-dimensional array with ones on the k diagonal and zeros
      elsewhere.
  
      Parameters
      ----------
      n_rows
          number of rows in the output array.
      n_cols
          number of columns in the output array. If None, the default number of columns in
          the output array is equal to n_rows. Default: ``None``.
      k
          index of the diagonal. A positive value refers to an upper diagonal, a negative
          value to a lower diagonal, and 0 to the main diagonal. Default: ``0``.
      batch_shape
          optional input that determines returning identity array shape.
          Default: ``None``.
      dtype
          output array data type. If dtype is None, the output array data type must be the
          default floating-point data type. Default: ``None``.
      device
          the device on which to place the created array.
      out
          optional output array, for writing the result to. It must have a shape that the
          inputs broadcast to.
  
      Returns
      -------
      ret
          device on which to place the created array. Default: ``None``.
  
  
      This function conforms to the `Array API Standard
      <https://data-apis.org/array-api/latest/>`_. This docstring is an extension of the
      `docstring <https://data-apis.org/array-api/latest/
      API_specification/generated/array_api.eye.html>`_
      in the standard.
  
      Both the description and the type hints above assumes an array input for simplicity,
      but this function is *nestable*, and therefore also accepts :class:`ivy.Container`
      instances as a replacement to any of the arguments.
  
      Examples
      --------
      With :'n_rows' input:
  
      >>> x = ivy.eye(3)
      >>> print(x)
      ivy.array([[1., 0., 0.],
                 [0., 1., 0.],
                 [0., 0., 1.]])
  
  
      With :'n_cols' input:
  
      >>> x = ivy.eye(3,4)
      >>> print(x)
      ivy.array([[1., 0., 0., 0.],
                 [0., 1., 0., 0.],
                 [0., 0., 1., 0.]])
  
  
      With :'k' input:
  
      >>> x = ivy.eye(3, k=1)
      >>> print(x)
      ivy.array([[0., 1., 0.],
                 [0., 0., 1.],
                 [0., 0., 0.]])
  
  
      With :'dtype' input:
  
      >>> x = ivy.eye(4, k=2, dtype=ivy.IntDtype('int32'))
      >>> print(x)
      ivy.array([[0, 0, 1, 0],
                 [0, 0, 0, 1],
                 [0, 0, 0, 0],
                 [0, 0, 0, 0]])
  
  
      With :'batch_shape' input:
  
      >>> x = ivy.eye(2, 3, batch_shape=[3])
      >>> print(x)
      ivy.array([[[1., 0., 0.],
                  [0., 1., 0.]],
  
                  [[1., 0., 0.],
                  [0., 1., 0.]],
  
                  [[1., 0., 0.],
                  [0., 1., 0.]]])
  
  
      With :'out' input:
  
      >>> y = ivy.ones((3, 3))
      >>> ivy.eye(3, out=y)
      >>> print(y)
      ivy.array([[1., 0., 0.],
                 [0., 1., 0.],
                 [0., 0., 1.]])
  
  
      With :'device' input:
  
      >>> x = ivy.eye(3, device=ivy.Device('cpu'))
      >>> print(x)
      ivy.array([[1., 0., 0.],
                 [0., 1., 0.],
                 [0., 0., 1.]])
      """
      return current_backend().eye(
          n_rows,
          n_cols,
          k=k,
          batch_shape=batch_shape,
          dtype=dtype,
          device=device,
          out=out,
      )
  
imports: from __future__ import annotations
  import functools
  from numbers import Number
  from typing import Union, Tuple, Optional, List, Sequence, Callable, Protocol, TypeVar, Iterable
  import numpy
  import ivy
  from ivy import to_ivy
  from ivy.utils.exceptions import handle_exceptions
  from ivy.utils.backend import current_backend
  from ivy.func_wrapper import handle_array_function, infer_dtype, handle_out_argument, outputs_to_ivy_arrays, inputs_to_native_arrays, inputs_to_native_shapes, to_native_arrays_and_back, handle_nestable, handle_array_like_without_promotion, handle_device, handle_backend_invalid, temp_asarray_wrapper
label_desc: Use image node_id 21 for calling a global function with example usage: eye() and returns: current_backend