def forward(self, logits, targets):
        """Forward propagation method for the Lovasz loss.

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

        @TODO: Docs. Contribution is welcome.
        """
        losses = [
            _lovasz_hinge(
                logits[:, i, ...],
                targets[:, i, ...],
                per_image=self.per_image,
                ignore=self.ignore,
            )
            for i in range(logits.shape[1])
        ]
        loss = torch.mean(torch.stack(losses))
        return loss
Forward propagation method for the Lovasz loss.

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

        @TODO: Docs. Contribution is welcome.
        
catalyst/contrib/losses/lovasz.py