def _batch_loss_entities(self, mask_combined_sequence_sentence: tf.Tensor, sequence_feature_lengths: tf.Tensor, text_transformed: tf.Tensor, tf_batch_data: Dict[(Text, Dict[(Text, List[tf.Tensor])])]) -> List[tf.Tensor]:
    losses = []
    entity_tags = None
    for tag_spec in self._entity_tag_specs:
        if (tag_spec.num_tags == 0):
            continue
        tag_ids = tf_batch_data[ENTITIES][tag_spec.tag_name][0]
        tag_ids = tf.pad(tag_ids, [[0, 0], [0, 1], [0, 0]])
        (loss, f1, _logits) = self._calculate_entity_loss(text_transformed, tag_ids, mask_combined_sequence_sentence, sequence_feature_lengths, tag_spec.tag_name, entity_tags)
        if (tag_spec.tag_name == ENTITY_ATTRIBUTE_TYPE):
            entity_tags = tf.one_hot(tf.cast(tag_ids[:, :, 0], tf.int32), depth=tag_spec.num_tags)
        self._update_entity_metrics(loss, f1, tag_spec.tag_name)
        losses.append(loss)
    return losses
def _batch_loss_entities(self, mask_combined_sequence_sentence: tf.Tensor, sequence_feature_lengths: tf.Tensor, text_transformed: tf.Tensor, tf_batch_data: Dict[(Text, Dict[(Text, List[tf.Tensor])])]) -> List[tf.Tensor]:
    losses = []
    entity_tags = None
    for tag_spec in self._entity_tag_specs:
        if (tag_spec.num_tags == 0):
            continue
        tag_ids = tf_batch_data[ENTITIES][tag_spec.tag_name][0]
        tag_ids = tf.pad(tag_ids, [[0, 0], [0, 1], [0, 0]])
        (loss, f1, _logits) = self._calculate_entity_loss(text_transformed, tag_ids, mask_combined_sequence_sentence, sequence_feature_lengths, tag_spec.tag_name, entity_tags)
        if (tag_spec.tag_name == ENTITY_ATTRIBUTE_TYPE):
            entity_tags = tf.one_hot(tf.cast(tag_ids[:, :, 0], tf.int32), depth=tag_spec.num_tags)
        self._update_entity_metrics(loss, f1, tag_spec.tag_name)
        losses.append(loss)
    return losses