code: def giou_loss(
      y_true: TensorLike, y_pred: TensorLike, mode: str = "giou"
  ) -> tf.Tensor:
      """Implements the GIoU loss function.
  
      GIoU loss was first introduced in the
      [Generalized Intersection over Union:
      A Metric and A Loss for Bounding Box Regression]
      (https://giou.stanford.edu/GIoU.pdf).
      GIoU is an enhancement for models which use IoU in object detection.
  
      Args:
          y_true: true targets tensor. The coordinates of the each bounding
              box in boxes are encoded as [y_min, x_min, y_max, x_max].
          y_pred: predictions tensor. The coordinates of the each bounding
              box in boxes are encoded as [y_min, x_min, y_max, x_max].
          mode: one of ['giou', 'iou'], decided to calculate GIoU or IoU loss.
  
      Returns:
          GIoU loss float `Tensor`.
      """
      if mode not in ["giou", "iou"]:
          raise ValueError("Value of mode should be 'iou' or 'giou'")
      y_pred = tf.convert_to_tensor(y_pred)
      if not y_pred.dtype.is_floating:
          y_pred = tf.cast(y_pred, tf.float32)
      y_true = tf.cast(y_true, y_pred.dtype)
      giou = tf.squeeze(_calculate_giou(y_pred, y_true, mode))
  
      return 1 - giou
  
file_path: addons/tensorflow_addons/losses/giou_loss.py
imports: from typing import Optional
  import tensorflow
  from typeguard import typechecked
  from tensorflow_addons.utils.keras_utils import LossFunctionWrapper
  from tensorflow_addons.utils.types import TensorLike
label_desc: Use image node_id 1 for calling a global function with example usage: giou_loss(y_true, y_pred, mode) and returns: unknown