def forward(self, logits, targets):
        """
        Args:
            logits: [bs; num_classes; ...]
            targets: [bs; ...]

        Returns:
            computed loss
        """
        num_classes = logits.size(1)
        loss = 0
        targets = targets.view(-1)
        logits = logits.view(-1, num_classes)

        # Filter anchors with -1 label from loss computation
        if self.ignore is not None:
            not_ignored = targets != self.ignore

        for class_id in range(num_classes):
            cls_label_target = (targets == (class_id + 0)).long()
            cls_label_input = logits[..., class_id]

            if self.ignore is not None:
                cls_label_target = cls_label_target[not_ignored]
                cls_label_input = cls_label_input[not_ignored]

            loss += self.loss_fn(cls_label_input, cls_label_target)

        return loss

        Args:
            logits: [bs; num_classes; ...]
            targets: [bs; ...]

        Returns:
            computed loss
        
catalyst/contrib/losses/focal.py