def compute_loss(target, output, criterion, weights, args, model, data):
    """
    Compute the loss.

    :param target: target labels
    :param output: predicted labels
    :param criterion: loss criterion
    :param weights: the weight per task / label
    :return: the computed loss
    """
    loss = criterion(output, target)
    return loss