class_docstr: Wraps a loss function in the `Loss` class.
class_docstr_tok: ["Wraps","a","loss","function","in","the","`","Loss","`","class","."]
docstr: Initializes `LossFunctionWrapper` class.
  
  Args:
    fn: The loss function to wrap, with signature `fn(y_true, y_pred,
      **kwargs)`.
    reduction: (Optional) Type of `tf.keras.losses.Reduction` to apply to
      loss. Default value is `AUTO`. `AUTO` indicates that the reduction
      option will be determined by the usage context. For almost all cases
      this defaults to `SUM_OVER_BATCH_SIZE`. When used with
      `tf.distribute.Strategy`, outside of built-in training loops such as
      `tf.keras` `compile` and `fit`, using `AUTO` or `SUM_OVER_BATCH_SIZE`
      will raise an error. Please see this custom training [tutorial](
        https://www.tensorflow.org/tutorials/distribute/custom_training)
      for more details.
    name: (Optional) name for the loss.
    **kwargs: The keyword arguments that are passed on to `fn`.
docstr_tok: ["Initializes","`","LossFunctionWrapper","`","class",".","Args",":","fn",":","The","loss","function","to","wrap",",","with","signature","`","fn","(","y_true",",","y_pred",",","*","*","kwargs",")","`",".","reduction",":","(","Optional",")","Type","of","`","tf.keras.losses.Reduction","`","to","apply","to","loss",".","Default","value","is","`","AUTO","`",".","`","AUTO","`","indicates","that","the","reduction","option","will","be","determined","by","the","usage","context",".","For","almost","all","cases","this","defaults","to","`","SUM_OVER_BATCH_SIZE","`",".","When","used","with","`","tf.distribute.Strategy","`",",","outside","of","built-in","training","loops","such","as","`","tf.keras","`","`","compile","`","and","`","fit","`",",","using","`","AUTO","`","or","`","SUM_OVER_BATCH_SIZE","`","will","raise","an","error",".","Please","see","this","custom","training","[","tutorial","]","(","https",":","\/\/www.tensorflow.org\/tutorials\/distribute\/custom_training",")","for","more","details",".","name",":","(","Optional",")","name","for","the","loss",".","*","*","kwargs",":","The","keyword","arguments","that","are","passed","on","to","`","fn","`","."]
code: def __init__(
      self,
      fn,
      reduction=tf.keras.losses.Reduction.AUTO,
      name=None,
      **kwargs,
  ):
      """Initializes `LossFunctionWrapper` class.
  
      Args:
        fn: The loss function to wrap, with signature `fn(y_true, y_pred,
          **kwargs)`.
        reduction: (Optional) Type of `tf.keras.losses.Reduction` to apply to
          loss. Default value is `AUTO`. `AUTO` indicates that the reduction
          option will be determined by the usage context. For almost all cases
          this defaults to `SUM_OVER_BATCH_SIZE`. When used with
          `tf.distribute.Strategy`, outside of built-in training loops such as
          `tf.keras` `compile` and `fit`, using `AUTO` or `SUM_OVER_BATCH_SIZE`
          will raise an error. Please see this custom training [tutorial](
            https://www.tensorflow.org/tutorials/distribute/custom_training)
          for more details.
        name: (Optional) name for the loss.
        **kwargs: The keyword arguments that are passed on to `fn`.
      """
      super().__init__(reduction=reduction, name=name)
      self.fn = fn
      self._fn_kwargs = kwargs
  
file_path: addons/tensorflow_addons/utils/keras_utils.py
imports: import tensorflow
label_desc: Use image node_id 1 to create a new LossFunctionWrapper object from inherited base classes: tf.keras.losses with example: obj = LossFunctionWrapper(fn, reduction, name)