def METHOD_NAME(self, predictions, batch, stage):
    """Computes the loss given predictions and targets."""
    batch = batch.to(self.device)
    tokens_eos, tokens_len = batch.tokens_eos
    loss = self.hparams.compute_cost(
        predictions, tokens_eos, length=tokens_len
    )
    return loss