def forward(self, pred, gt, weight, mask, detach=False, occlusion_aware=True):
        """

        :param pred: [N_pts, 3]
        :param gt: [N_pts, 3]
        :param weight: [N_pts]
        :param mask: [N_pts]
        :return:
        """
        if detach:
            weight = weight.detach()

        error = torch.abs(pred - gt).sum(dim=-1, keepdim=False)  # [N_pts]
        error = error[mask]

        if not (self.occlusion_aware and occlusion_aware):
            return torch.mean(error), torch.mean(error)

        beta = self.adjuster(weight.mean())

        # weight = weight[mask]
        weight = weight.clamp(0.0, 1.0)
        term1 = self.alpha * torch.mean(weight[mask] * error)
        term2 = beta * torch.log(1 - weight + self.eps).mean()
        term3 = self.gama * torch.log(weight + self.eps).mean()

        return term1 + term2 + term3, term1


        :param pred: [N_pts, 3]
        :param gt: [N_pts, 3]
        :param weight: [N_pts]
        :param mask: [N_pts]
        :return:
        
mv-diffusion/One-2-3-45/reconstruction/loss/color_loss.py