code: def qr(
      x: Union[ivy.Array, ivy.NativeArray],
      /,
      *,
      mode: str = "reduced",
      out: Optional[Tuple[ivy.Array, ivy.Array]] = None,
  ) -> Tuple[ivy.Array, ivy.Array]:
      """Return the qr decomposition x = QR of a full column rank matrix (or a
      stack of matrices), where Q is an orthonormal matrix (or a stack of
      matrices) and R is an upper-triangular matrix (or a stack of matrices).
  
      Parameters
      ----------
      x
          input array having shape (..., M, N) and whose innermost two dimensions form MxN
          matrices of rank N. Should have a floating-point data type.
      mode
          decomposition mode. Should be one of the following modes:
          - 'reduced': compute only the leading K columns of q, such that q and r have
            dimensions (..., M, K) and (..., K, N), respectively, and where K = min(M, N).
          - 'complete': compute q and r with dimensions (..., M, M) and (..., M, N),
            respectively.
          Default: 'reduced'.
      out
          optional output tuple of arrays, for writing the result to. The arrays must have
          shapes that the inputs broadcast to.
  
      Returns
      -------
      ret
          a namedtuple (Q, R) whose
          - first element must have the field name Q and must be an array whose shape
            depends on the value of mode and contain matrices with orthonormal columns.
            If mode is 'complete', the array must have shape (..., M, M). If mode is
            'reduced', the array must have shape (..., M, K), where K = min(M, N). The
            first x.ndim-2 dimensions must have the same size as those of the input array
            x.
          - second element must have the field name R and must be an array whose shape
            depends on the value of mode and contain upper-triangular matrices. If mode is
            'complete', the array must have shape (..., M, N). If mode is 'reduced', the
            array must have shape (..., K, N), where K = min(M, N). The first x.ndim-2
            dimensions must have the same size as those of the input 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.qr.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.array([[1.,2.,3.],[4.,5.,6.],[7.,8.,9.]])
      >>> q, r = ivy.qr(x)
      >>> print(q)
      ivy.array([[-0.12309149,  0.90453403,  0.40824829],
          [-0.49236596,  0.30151134, -0.81649658],
          [-0.86164044, -0.30151134,  0.40824829]])
      >>> print(r)
      ivy.array([[-8.12403841e+00,-9.60113630e+00, -1.10782342e+01],
          [ 0.00000000e+00,  9.04534034e-01,  1.80906807e+00],
          [ 0.00000000e+00,  0.00000000e+00, -8.88178420e-16]])
  
      # Note: if `int` values are used in `x` the output for q, r vary
      >>> x = ivy.array([[1., 2.], [3., 4.]])
      >>> q = ivy.zeros_like(x)
      >>> r = ivy.zeros_like(x)
      >>> ivy.qr(x, out=(q,r))
      >>> print(q)
      ivy.array([[-0.31622776, -0.94868332],
             [-0.94868332,  0.31622776]])
      >>> print(r)
      ivy.array([[-3.1622777 , -4.42718887],
             [ 0.        , -0.63245553]])
  
      With :class:`ivy.Container` input:
  
      >>> x = ivy.Container(a = ivy.native_array([[1., 2.], [3., 4.]]),
      ...                   b = ivy.array([[2., 3.], [4. ,5.]]))
      >>> q,r = ivy.qr(x, mode='complete')
      >>> print(q)
      {
          a: ivy.array([[-0.31622777, -0.9486833],
                      [-0.9486833, 0.31622777]]),
          b: ivy.array([[-0.4472136, -0.89442719],
                      [-0.89442719, 0.4472136]])
      }
      >>> print(r)
      {
          a: ivy.array([[-3.16227766, -4.42718872],
                      [0., -0.63245553]]),
          b: ivy.array([[-4.47213595, -5.81377674],
                      [0., -0.4472136]])
      }
      """
      return current_backend(x).qr(x, mode=mode, 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 17 for calling a global function with example usage: qr() and returns: current_backend