class_docstr: Creates a TF Privacy-enabled version of MultiClassHead.
docstr: Returns regularized training loss. See `base_head.Head` for details.
code: def loss(
      self,
      labels,
      logits,
      features=None,
      mode=None,
      regularization_losses=None,
  ):
      """Returns regularized training loss. See `base_head.Head` for details."""
      del mode  # Unused for this head.
      with tf.compat.v1.name_scope(
          "losses",
          values=(logits, labels, regularization_losses, features),
      ):
          logits = base_head.check_logits_final_dim(
              logits, self.logits_dimension
          )
          labels = self._processed_labels(logits, labels)
          unweighted_loss, weights = self._unweighted_loss_and_weights(
              logits, labels, features
          )
          vector_training_loss = (
              tf.keras.__internal__.losses.compute_weighted_loss(
                  unweighted_loss,
                  sample_weight=weights,
                  reduction=tf.keras.losses.Reduction.NONE,
              )
          )
          regularization_loss = (
              tf.math.add_n(regularization_losses)
              if regularization_losses is not None
              else None
          )
          vector_regularized_training_loss = (
              tf.add(vector_training_loss, regularization_loss)
              if regularization_loss is not None
              else vector_training_loss
          )
  
      return vector_regularized_training_loss
  
file_path: privacy/tensorflow_privacy/privacy/estimators/multi_class_head.py
imports: import tensorflow
  from tensorflow_estimator.python.estimator import model_fn
  from tensorflow_estimator.python.estimator.canned import prediction_keys
  from tensorflow_estimator.python.estimator.export import export_output
  from tensorflow_estimator.python.estimator.head import base_head
  from tensorflow_estimator.python.estimator.head import multi_class_head
  from tensorflow_estimator.python.estimator.mode_keys import ModeKeys
label_desc: Use image node_id 2 for calling the DPMultiClassHead obj's underlying member method code with example usage: obj.loss(labels, logits, features, mode, regularization_losses) and returns: vector_regularized_training_loss