def METHOD_NAME(self, scores, labels, valid_mode=False, **kwargs):
    """Calculate the loss accroding to the model output ```scores```,
       and the target ```labels```.
    Args:
        scores (paddle.Tensor): The output of the model.
        labels (paddle.Tensor): The target output of the model.
    Returns:
        losses (dict): A dict containing field 'loss'(mandatory).
    """
    if len(labels) == 1:  #commonly case
        output = []
        label = []
        labels = labels[0]
        losses = dict()
        METHOD_NAME = self.loss_func(scores, labels, **kwargs)
        score_list = paddle.tolist(scores)
        label_list = paddle.tolist(labels)
        score_list_len = len(score_list)
        for i in range(score_list_len):
            output.append(score_list[i][0])
            label.append(label_list[i][0])
        losses['loss'] = METHOD_NAME
        losses['output'] = output
        losses['label'] = label
        return losses
    elif len(labels) == 3:
        labels_a, labels_b, lam = labels
        labels_a = paddle.cast(labels_a, dtype='float32')
        labels_b = paddle.cast(labels_b, dtype='float32')
        lam = lam[0]  # get lam value
        losses = dict()
        if self.ls_eps != 0:
            loss_a = self.label_smooth_loss(scores, labels_a, **kwargs)
            loss_b = self.label_smooth_loss(scores, labels_b, **kwargs)
        else:
            loss_a = self.loss_func(scores, labels_a, **kwargs)
            loss_b = self.loss_func(scores, labels_a, **kwargs)
        METHOD_NAME = lam * loss_a + (1 - lam) * loss_b
        losses['loss'] = METHOD_NAME
        losses['output'] = output
        losses['label'] = label
        return losses
    else:
        raise NotImplementedError