class_docstr: Implements the focal loss function.
  
  Focal loss was first introduced in the RetinaNet paper
  (https://arxiv.org/pdf/1708.02002.pdf). Focal loss is extremely useful for
  classification when you have highly imbalanced classes. It down-weights
  well-classified examples and focuses on hard examples. The loss value is
  much higher for a sample which is misclassified by the classifier as compared
  to the loss value corresponding to a well-classified example. One of the
  best use-cases of focal loss is its usage in object detection where the
  imbalance between the background class and other classes is extremely high.
  
  Usage:
  
  >>> fl = tfa.losses.SigmoidFocalCrossEntropy()
  >>> loss = fl(
  ...     y_true = [[1.0], [1.0], [0.0]],y_pred = [[0.97], [0.91], [0.03]])
  >>> loss
  <tf.Tensor: shape=(3,), dtype=float32, numpy=array([6.8532745e-06, 1.9097870e-04, 2.0559824e-05],
  dtype=float32)>
  
  Usage with `tf.keras` API:
  
  >>> model = tf.keras.Model()
  >>> model.compile('sgd', loss=tfa.losses.SigmoidFocalCrossEntropy())
  
  Args:
    alpha: balancing factor, default value is 0.25.
    gamma: modulating factor, default value is 2.0.
  
  Returns:
    Weighted loss float `Tensor`. If `reduction` is `NONE`, this has the same
        shape as `y_true`; otherwise, it is scalar.
  
  Raises:
      ValueError: If the shape of `sample_weight` is invalid or value of
        `gamma` is less than zero.
code: def __init__(
      self,
      from_logits: bool = False,
      alpha: FloatTensorLike = 0.25,
      gamma: FloatTensorLike = 2.0,
      reduction: str = tf.keras.losses.Reduction.NONE,
      name: str = "sigmoid_focal_crossentropy",
  ):
      super().__init__(
          sigmoid_focal_crossentropy,
          name=name,
          reduction=reduction,
          from_logits=from_logits,
          alpha=alpha,
          gamma=gamma,
      )
  
file_path: addons/tensorflow_addons/losses/focal_loss.py
imports: import tensorflow
  import tensorflow.keras.backend
  from typeguard import typechecked
  from tensorflow_addons.utils.keras_utils import LossFunctionWrapper
  from tensorflow_addons.utils.types import FloatTensorLike, TensorLike
label_desc: Use image node_id 1 to create a new SigmoidFocalCrossEntropy object from inherited base classes: LossFunctionWrapper with example: obj = SigmoidFocalCrossEntropy(from_logits, alpha, gamma, reduction, name)