def METHOD_NAME(self, prediction, mask):
    loss_fct = paddle.nn.BCEWithLogitsLoss()
    pos_logits, neg_logits = prediction
    pos_labels, neg_labels = paddle.ones_like(
        pos_logits), paddle.zeros_like(neg_logits)
    loss = loss_fct(
        paddle.masked_select(pos_logits, mask),
        paddle.masked_select(pos_labels, mask))
    loss += loss_fct(
        paddle.masked_select(neg_logits, mask),
        paddle.masked_select(neg_labels, mask))
    return loss