code: def __init__(self, tfrs_model: tfrs.Model) -> None:
      super().__init__()
      log4Error.invalidInputError(
          isinstance(tfrs_model, tfrs.Model),
          "FriesianTFRSModel only support tfrs.Model, but got "
          + tfrs_model.__class__.__name__,
      )
      log4Error.invalidInputError(
          not tfrs_model._is_compiled,
          "TFRSModel should be initialized before compiling.",
      )
      attr = tfrs_model.__dict__
      task_dict = dict()
      for k, v in attr.items():
          if isinstance(v, base.Task):
              task_dict[k] = v
  
      for k, v in task_dict.items():
          try:
              v._loss.reduction = tf.keras.losses.Reduction.NONE
          except:
              warnings.warn(
                  "Model task "
                  + k
                  + " has no attribute _loss, please use "
                  "`tf.keras.losses.Reduction.SUM` or "
                  "`tf.keras.losses.Reduction.NONE` for "
                  "loss reduction in this task if the "
                  "Estimator throw an error."
              )
      self.model = tfrs_model
  
file_path: BigDL/python/friesian/src/bigdl/friesian/models/tfrs_model.py
imports: from turtle import Turtle
  import tensorflow
  import warnings
  import tensorflow_recommenders
  from tensorflow_recommenders.tasks import base
  from bigdl.dllib.utils import log4Error
  from typing import Dict
label_desc: Use image node_id 1 to create a new TFRSModel object from inherited base classes: tf.keras with example: obj = TFRSModel(tfrs_model)