class_docstr: Task object for TF-Ranking.
class_docstr_tok: ["Task","object","for","TF-Ranking","."]
code: def build_losses(
      self, labels, model_outputs, aux_losses=None
  ) -> tf.Tensor:
      ranking_loss = tfr_losses.get(
          loss=self.task_config.loss,
          reduction=self.task_config.loss_reduction,
      )
      loss = ranking_loss(
          tf.cast(labels, tf.float32),
          tf.cast(model_outputs, tf.float32),
      )
      if aux_losses:
          loss += tf.add_n(aux_losses)
      return tf_utils.safe_mean(loss)
  
imports: import dataclasses
  from typing import Callable, Dict, Mapping, Optional, Tuple, Union
  import tensorflow
  from tensorflow_ranking.python import data
  from tensorflow_ranking.python.keras import losses
  from tensorflow_ranking.python.keras import metrics
  from tensorflow_ranking.python.keras import model
label_desc: Use image node_id 4 for calling the RankingTask obj's underlying member method code with example usage: obj.build_losses(labels, model_outputs, aux_losses) and returns: tf_utils