def forward(
        self,
        pred_map: torch.Tensor,
        pred_score: torch.Tensor,
        target_mask: torch.Tensor,
        target_label: torch.Tensor,
    ) -> torch.Tensor:
        """Calculate loss based on predicted anomaly maps and scores.

        Total loss = Lseg and Lcls
        where
        Lseg = Lfocal(map) + Ltruncl1(map)
        Lcls = Lfocal(score)

        Args:
            pred_map: predicted anomaly maps.
            pred_score: predicted anomaly scores.
            target_mask: GT anomaly masks.
            target_label: GT anomaly labels.

        Returns:
            torch.Tensor: loss value.
        """
        map_focal = self.focal_loss(pred_map, target_mask)
        map_trunc_l1 = self.trunc_l1_loss(pred_map, target_mask)
        score_focal = self.focal_loss(pred_score, target_label)

        return map_focal + map_trunc_l1 + score_focal
Calculate loss based on predicted anomaly maps and scores.

        Total loss = Lseg and Lcls
        where
        Lseg = Lfocal(map) + Ltruncl1(map)
        Lcls = Lfocal(score)

        Args:
            pred_map: predicted anomaly maps.
            pred_score: predicted anomaly scores.
            target_mask: GT anomaly masks.
            target_label: GT anomaly labels.

        Returns:
            torch.Tensor: loss value.
        
src/anomalib/models/image/supersimplenet/loss.py