code: def svd(
      x: Union[ivy.Array, ivy.NativeArray],
      /,
      *,
      compute_uv: bool = True,
      full_matrices: bool = True,
  ) -> Union[ivy.Array, Tuple[ivy.Array, ...]]:
      """Return a singular value decomposition A = USVh of a matrix (or a stack
      of matrices) ``x``, where ``U`` is a matrix (or a stack of matrices) with
      orthonormal columns, ``S`` is a vector of non-negative numbers (or stack of
      vectors), and ``Vh`` is a matrix (or a stack of matrices) with orthonormal
      rows.
  
      Parameters
      ----------
      x
          input array having shape ``(..., M, N)`` and whose innermost two dimensions form
          matrices on which to perform singular value decomposition. Should have a
          floating-point data type.
      full_matrices
          If ``True``, compute full-sized ``U`` and ``Vh``, such that ``U`` has shape
          ``(..., M, M)`` and ``Vh`` has shape ``(..., N, N)``. If ``False``, compute on
          the leading ``K`` singular vectors, such that ``U`` has shape ``(..., M, K)``
          and ``Vh`` has shape ``(..., K, N)`` and where ``K = min(M, N)``.
          Default: ``True``.
      compute_uv
          If ``True`` then left and right singular vectors will be computed and returned
          in ``U`` and ``Vh``, respectively. Otherwise, only the singular values will be
          computed, which can be significantly faster.
      .. note::
          with backend set as torch, svd with still compute left and right singular
          vectors irrespective of the value of compute_uv, however Ivy will still
          only return the singular values.
  
      Returns
      -------
      .. note::
          once complex numbers are supported, each square matrix must be Hermitian.
  
      ret
          a namedtuple ``(U, S, Vh)`` whose
  
          -   first element must have the field name ``U`` and must be an array whose
              shape depends on the value of ``full_matrices`` and contain matrices with
              orthonormal columns (i.e., the columns are left singular vectors). If
              ``full_matrices`` is ``True``, the array must have shape ``(..., M, M)``.
              If ``full_matrices`` is ``False``, the array must have shape
              ``(..., M, K)``, where ``K = min(M, N)``. The first ``x.ndim-2`` dimensions
              must have the same shape as those of the input ``x``.
          -   second element must have the field name ``S`` and must be an array with
              shape ``(..., K)`` that contains the vector(s) of singular values of length
              ``K``, where ``K = min(M, N)``. For each vector, the singular values must be
              sorted in descending order by magnitude, such that ``s[..., 0]`` is the
              largest value, ``s[..., 1]`` is the second largest value, et cetera. The
              first ``x.ndim-2`` dimensions must have the same shape as those of the input
              ``x``. Must have a real-valued floating-point data type having the same
              precision as ``x`` (e.g., if ``x`` is ``complex64``, ``S`` must have
              a ``float32`` data type).
          -   third element must have the field name ``Vh`` and must be an array whose
              shape depends on the value of ``full_matrices`` and contain orthonormal rows
              (i.e., the rows are the right singular vectors and the array is the
              adjoint). If ``full_matrices`` is ``True``, the array must have shape
              ``(..., N, N)``. If ``full_matrices`` is ``False``, the array must have
              shape ``(..., K, N)`` where ``K = min(M, N)``. The first ``x.ndim-2``
              dimensions must have the same shape as those of the input ``x``. Must
              have the same data type as ``x``.
  
          Each returned array must have the same floating-point data type as ``x``.
  
  
      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.svd.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 :class:`ivy.Array` input:
  
      >>> x = ivy.random_normal(shape = (9, 6))
      >>> U, S, Vh = ivy.svd(x)
      >>> print(U.shape, S.shape, Vh.shape)
      (9, 9) (6,) (6, 6)
  
      With reconstruction from SVD, result is numerically close to x
  
      >>> reconstructed_x = ivy.matmul(U[:,:6] * S, Vh)
      >>> print((reconstructed_x - x > 1e-3).sum())
      ivy.array(0)
  
      >>> U, S, Vh = ivy.svd(x, full_matrices = False)
      >>> print(U.shape, S.shape, Vh.shape)
      (9, 6) (6,) (6, 6)
  
  
      With :class:`ivy.Container` input:
  
      >>> x = ivy.Container(a=ivy.array([[2.0, 3.0, 6.0], [5.0, 3.0, 4.0],
      ...                                [1.0, 7.0, 3.0], [3.0, 2.0, 5.0]]),
      ...                   b=ivy.array([[7.0, 1.0, 2.0, 3.0, 9.0],
      ...                                [2.0, 5.0, 3.0, 4.0, 10.0],
      ...                                [2.0, 11.0, 6.0, 1.0, 3.0],
      ...                                [8.0, 3.0, 4.0, 5.0, 9.0]]))
      >>> U, S, Vh = ivy.svd(x)
      >>> print(U.shape)
      {
      a: [
          4,
          4
      ],
      b: [
          4,
          4
      ]
      }
      """
      return current_backend(x).svd(
          x, compute_uv=compute_uv, full_matrices=full_matrices
      )
  
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 20 for calling a global function with example usage: svd() and returns: current_backend