def METHOD_NAME(self):
    assert self.mode != 'infer', "invalid loss calculationg in infer mode"
    cost = paddle.nn.functional.binary_cross_entropy(
        input=self.logit, label=self.label_input, reduction=None)
    cost = paddle.sum(x=cost, axis=-1)
    sum_cost = paddle.sum(x=cost)
    self.loss_ = paddle.scale(sum_cost,
                                    scale=self.num_gpus,
                                    bias_after_scale=False)
    return self.loss_