code: def matrix_rank(
      x: Union[ivy.Array, ivy.NativeArray],
      /,
      *,
      atol: Optional[Union[float, Tuple[float]]] = None,
      rtol: Optional[Union[float, Tuple[float]]] = None,
      hermitian: Optional[bool] = False,
      out: Optional[ivy.Array] = None,
  ) -> ivy.Array:
      """Return the rank (i.e., number of non-zero singular values) of a matrix
      (or a stack of matrices).
  
      Parameters
      ----------
      x
          input array having shape ``(..., M, N)`` and whose innermost two dimensions form
          ``MxN`` matrices. Should have a floating-point data type.
  
      atol
          absolute tolerance. When None it's considered to be zero.
  
      rtol
          relative tolerance for small singular values. Singular values approximately less
          than or equal to ``rtol * largest_singular_value`` are set to zero. If a
          ``float``, the value is equivalent to a zero-dimensional array having a
          floating-point data type determined by :ref:`type-promotion` (as applied to
          ``x``) and must be broadcast against each matrix. If an ``array``, must have a
          floating-point data type and must be compatible with ``shape(x)[:-2]`` (see
          :ref:`broadcasting`). If ``None``, the default value is ``max(M, N) * eps``,
          where ``eps`` must be the machine epsilon associated with the floating-point
          data type determined by :ref:`type-promotion` (as applied to ``x``).
          Default: ``None``.
  
      hermitian
          indicates whether ``x`` is Hermitian. When ``hermitian=True``, ``x``
          is assumed to be Hermitian, enabling a more efficient method for finding
          eigenvalues, but x is not checked inside the function.
          Instead, We just use the lower triangular of the matrix to compute.
          Default: ``False``.
      out
          optional output array, for writing the result to. It must have a shape that the
          inputs broadcast to.
  
      Returns
      -------
      ret
          an array containing the ranks. The returned array must have a floating-point
          data type determined by :ref:`type-promotion` and must have shape ``(...)``
          (i.e., must have a shape equal to ``shape(x)[:-2]``).
  
  
      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/
      extensions/generated/array_api.linalg.matrix_rank.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 in place of any of the arguments.
  
      Examples
      --------
      With :code: 'ivy.Array' inputs:
  
      1. Full Matrix
  
      >>> x = ivy.array([[1., 2.], [3., 4.]])
      >>> ivy.matrix_rank(x)
      ivy.array(2.)
  
      2. Rank Deficient Matrix
  
      >>> x = ivy.array([[1., 0.], [0., 0.]])
      >>> ivy.matrix_rank(x)
      ivy.array(1.)
  
      3. 1 Dimension - rank 1 unless all 0
  
      >>> x = ivy.array([[1., 1.])
      >>> ivy.matrix_rank(x)
      ivy.array(1.)
  
      >>> x = ivy.array([[0., 0.])
      >>> ivy.matrix_rank(x)
      ivy.array(0)
  
      With :code: 'ivy.NativeArray' inputs:
  
      >>> x = ivy.native_array([[1., 2.], [3., 4.]], [[1., 0.], [0., 0.]])
      >>> ivy.matrix_rank(x)
      ivy.array([2., 1.])
  
      With :code: 'ivy.Container' inputs:
      >>> x = ivy.Container(a = ivy.array([[1., 2.], [3., 4.]]), \
                            b = ivy.array([[1., 0.], [0., 0.]]))
      >>> ivy.matrix_rank(x)
      {
          a:ivy.array(2.),
          b:ivy.array(1.)
      }
      """
      return current_backend(x).matrix_rank(
          x, atol=atol, rtol=rtol, hermitian=hermitian, out=out
      )
  
imports: from typing import Union, Optional, Tuple, Literal, List, Sequence
  import ivy
  from ivy.utils.backend import current_backend
  from ivy.func_wrapper import handle_array_function, to_native_arrays_and_back, handle_out_argument, handle_nestable, handle_array_like_without_promotion, handle_device, handle_backend_invalid
  from ivy.utils.exceptions import handle_exceptions
label_desc: Use image node_id 13 for calling a global function with example usage: matrix_rank() and returns: current_backend