def METHOD_NAME(self, data):
    x, y, sample_weight = self.unpack_training_data(data)
    (potentials, sequence_length, kernel), decode_sequence, *_ = self(
        x, training=False, return_crf_internal=True
    )
    crf_loss = self.compute_crf_loss(
        potentials, sequence_length, kernel, y, sample_weight
    )
    loss = crf_loss + tf.reduce_sum(self.losses)
    # Update metrics (includes the metric that tracks the loss)
    self.compiled_metrics.update_state(y, decode_sequence)
    # Return a dict mapping metric names to current value
    results = {m.name: m.result() for m in self.metrics}
    results.update({"loss": loss, "crf_loss": crf_loss})  # append loss
    return results