class_docstr: Wraps a loss function in the `Loss` class.
class_docstr_tok: ["Wraps","a","loss","function","in","the","`","Loss","`","class","."]
docstr: Initialize the loss function.
docstr_tok: ["Initialize","the","loss","function","."]
code: def __init__(self, func, reduction=None, name=None, **kwargs):
      """Initialize the loss function."""
      if reduction is None:
          reduction = tf.keras.losses.Reduction.NONE
      super().__init__(reduction=reduction, name=name)
      self.fn = func
      self._fn_kwargs = kwargs
  
imports: import cloudpickle
  import tensorflow
  import numpy
  from functools import wraps, partial
  from tempfile import TemporaryDirectory
  import os
  import json
  from bigdl.nano.utils.common import schedule_processors
  from bigdl.nano.tf.keras.distributed_utils import _find_free_port
  from tensorflow.keras.losses import Loss
  import warnings
  from bigdl.nano.utils.common import invalidInputError
label_desc: Use image node_id 1 to create a new Nano_Customized_Loss object from inherited base classes: Loss with example: obj = Nano_Customized_Loss(func, reduction, name)