def forward(self, outputs: torch.Tensor, targets: torch.Tensor) -> torch.Tensor:
        """Forward propagation method for the roc-star loss.

        Args:
            outputs: Tensor of model predictions in [0, 1] range. Shape ``(B x 1)``.
            targets: Tensor of true labels in {0, 1}. Shape ``(B x 1)``.

        Returns:
            computed loss
        """
        self._assert_equal_size(outputs, targets)

        if torch.sum(targets) == 0 or torch.sum(targets) == targets.shape[0]:
            return torch.sum(outputs) * 1e-8

        if self.steps % self.update_gamma_each == 0:
            self._update_gamma()
        self.steps += 1

        positive = outputs[targets > 0]
        negative = outputs[targets < 1]

        # Take last `sample_size` elements from history
        outputs_history = self.outputs_history[-self.sample_size :]
        targets_history = self.targets_history[-self.sample_size :]

        positive_history = outputs_history[targets_history > 0]
        negative_history = outputs_history[targets_history < 1]

        if positive.size(0) > 0:
            diff = negative_history.view(1, -1) + self.gamma - positive.view(-1, 1)
            loss_positive = nn.functional.relu(diff ** 2).mean()
        else:
            loss_positive = 0

        if negative.size(0) > 0:
            diff = negative.view(1, -1) + self.gamma - positive_history.view(-1, 1)
            loss_negative = nn.functional.relu(diff ** 2).mean()
        else:
            loss_negative = 0

        loss = loss_negative + loss_positive

        # Update FIFO queue
        batch_size = outputs.size(0)
        self.outputs_history = torch.cat(
            (self.outputs_history[batch_size:], outputs.clone().detach())
        )
        self.targets_history = torch.cat(
            (self.targets_history[batch_size:], targets.clone().detach())
        )

        return loss
Forward propagation method for the roc-star loss.

        Args:
            outputs: Tensor of model predictions in [0, 1] range. Shape ``(B x 1)``.
            targets: Tensor of true labels in {0, 1}. Shape ``(B x 1)``.

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