code: def eye(
      n_rows: int,
      n_cols: Optional[int] = None,
      /,
      *,
      k: int = 0,
      batch_shape: Optional[Union[int, Sequence[int]]] = None,
      dtype: tf.DType,
      device: Optional[str] = None,
      out: Optional[Union[tf.Tensor, tf.Variable]] = None,
  ) -> Union[tf.Tensor, tf.Variable]:
      if n_cols is None:
          n_cols = n_rows
      if batch_shape is None:
          batch_shape = []
      i = tf.eye(n_rows, n_cols, dtype=dtype)
      reshape_dims = [1] * len(batch_shape) + [n_rows, n_cols]
      tile_dims = list(batch_shape) + [1, 1]
  
      # 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``.
      # value of k ranges from -n_rows < k < n_cols
  
      # k=0 refers to the main diagonal
      if k == 0:
          return tf.eye(
              n_rows, n_cols, batch_shape=batch_shape, dtype=dtype
          )
  
      # when k is negative
      elif -n_rows < k < 0:
          mat = tf.concat(
              [tf.zeros([-k, n_cols], dtype=dtype), i[: n_rows + k]],
              0,
          )
          return tf.tile(tf.reshape(mat, reshape_dims), tile_dims)
  
      elif 0 < k < n_cols:
          mat = tf.concat(
              [
                  tf.zeros([n_rows, k], dtype=dtype),
                  i[:, : n_cols - k],
              ],
              1,
          )
          return tf.tile(tf.reshape(mat, reshape_dims), tile_dims)
      else:
          return tf.zeros(batch_shape + [n_rows, n_cols], dtype=dtype)
  
imports: import numpy
  from numbers import Number
  from typing import Union, List, Optional, Sequence, Tuple
  import tensorflow
  import ivy
  from ivy.func_wrapper import with_unsupported_dtypes
  from ivy.functional.ivy.creation import _asarray_to_native_arrays_and_back, _asarray_infer_device, _asarray_infer_dtype, _asarray_handle_nestable, NestedSequence, SupportsBufferProtocol, _asarray_inputs_to_native_shapes
  from .None import backend_version
label_desc: Use image node_id 5 for calling a global function with example usage: eye() and returns: tf, tf, tf, tf