def batch_loss(self, batch_in: Union[(Tuple[tf.Tensor], Tuple[np.ndarray])]) -> tf.Tensor:
    'Calculates the loss for the given batch.\n\n        Args:\n            batch_in: The batch.\n\n        Returns:\n            The loss of the given batch.\n        '
    tf_batch_data = self.batch_to_model_data_format(batch_in, self.data_signature)
    sequence_feature_lengths = self._get_sequence_feature_lengths(tf_batch_data, TEXT)
    (text_transformed, text_in, mask_combined_sequence_sentence, text_seq_ids, mlm_mask_boolean_text, _) = self._tf_layers[f'sequence_layer.{self.text_name}']((tf_batch_data[TEXT][SEQUENCE], tf_batch_data[TEXT][SENTENCE], sequence_feature_lengths), training=self._training)
    losses = []
    sentence_feature_lengths = self._get_sentence_feature_lengths(tf_batch_data, TEXT)
    combined_sequence_sentence_feature_lengths = (sequence_feature_lengths + sentence_feature_lengths)
    if self.config[MASKED_LM]:
        (loss, acc) = self._mask_loss(text_transformed, text_in, text_seq_ids, mlm_mask_boolean_text, TEXT)
        self.mask_loss.update_state(loss)
        self.mask_acc.update_state(acc)
        losses.append(loss)
    if self.config[INTENT_CLASSIFICATION]:
        loss = self._batch_loss_intent(combined_sequence_sentence_feature_lengths, text_transformed, tf_batch_data)
        losses.append(loss)
    if self.config[ENTITY_RECOGNITION]:
        losses += self._batch_loss_entities(mask_combined_sequence_sentence, sequence_feature_lengths, text_transformed, tf_batch_data)
    return tf.math.add_n(losses)
Calculates the loss for the given batch.

Args:
    batch_in: The batch.

Returns:
    The loss of the given batch.
def batch_loss(self, batch_in: Union[(Tuple[tf.Tensor], Tuple[np.ndarray])]) -> tf.Tensor:
    'Calculates the loss for the given batch.\n\n        Args:\n            batch_in: The batch.\n\n        Returns:\n            The loss of the given batch.\n        '
    tf_batch_data = self.batch_to_model_data_format(batch_in, self.data_signature)
    sequence_feature_lengths = self._get_sequence_feature_lengths(tf_batch_data, TEXT)
    (text_transformed, text_in, mask_combined_sequence_sentence, text_seq_ids, mlm_mask_boolean_text, _) = self._tf_layers[f'sequence_layer.{self.text_name}']((tf_batch_data[TEXT][SEQUENCE], tf_batch_data[TEXT][SENTENCE], sequence_feature_lengths), training=self._training)
    losses = []
    sentence_feature_lengths = self._get_sentence_feature_lengths(tf_batch_data, TEXT)
    combined_sequence_sentence_feature_lengths = (sequence_feature_lengths + sentence_feature_lengths)
    if self.config[MASKED_LM]:
        (loss, acc) = self._mask_loss(text_transformed, text_in, text_seq_ids, mlm_mask_boolean_text, TEXT)
        self.mask_loss.update_state(loss)
        self.mask_acc.update_state(acc)
        losses.append(loss)
    if self.config[INTENT_CLASSIFICATION]:
        loss = self._batch_loss_intent(combined_sequence_sentence_feature_lengths, text_transformed, tf_batch_data)
        losses.append(loss)
    if self.config[ENTITY_RECOGNITION]:
        losses += self._batch_loss_entities(mask_combined_sequence_sentence, sequence_feature_lengths, text_transformed, tf_batch_data)
    return tf.math.add_n(losses)