code: def qr(
      x: Union[tf.Tensor, tf.Variable],
      /,
      *,
      mode: str = "reduced",
      out: Optional[
          Tuple[
              Union[tf.Tensor, tf.Variable],
              Union[tf.Tensor, tf.Variable],
          ]
      ] = None,
  ) -> Tuple[
      Union[tf.Tensor, tf.Variable], Union[tf.Tensor, tf.Variable]
  ]:
      res = namedtuple("qr", ["Q", "R"])
      if mode == "reduced":
          q, r = tf.linalg.qr(x, full_matrices=False)
          ret = res(q, r)
      elif mode == "complete":
          q, r = tf.linalg.qr(x, full_matrices=True)
          ret = res(q, r)
      else:
          raise ivy.utils.exceptions.IvyException(
              "Only 'reduced' and 'complete' qr modes are allowed "
              "for the tensorflow backend."
          )
      return ret
  
imports: from typing import Union, Optional, Tuple, Literal, List, NamedTuple, Sequence
  from collections import namedtuple
  import tensorflow
  from tensorflow.python.framework.dtypes import DType
  import ivy
  from ivy import inf
  from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes
  from .None import backend_version
label_desc: Use image node_id 17 for calling a global function with example usage: qr() and returns: ret