def forward(self, out0: Tensor, out1: Tensor) -> Tensor:
        """Computes the CO2 regularization term for two model outputs.

        Args:
            out0:
                Output projections of the first set of transformed images.
            out1:
                Output projections of the second set of transformed images.

        Returns:
            The regularization term multiplied by the weight factor alpha.
        """

        # Normalize the output to length 1
        out0 = torch.nn.functional.normalize(out0, dim=1)
        out1 = torch.nn.functional.normalize(out1, dim=1)

        # Update the memory bank with out1 and get negatives(if memory bank size > 0)
        # If the memory_bank size is 0, negatives will be None
        out1, negatives = self.memory_bank.forward(out1, update=True)

        # Get log probabilities
        p = self._get_pseudo_labels(out0, out1, negatives)
        q = self._get_pseudo_labels(out1, out0, negatives)

        # Calculate symmetrized Kullback-Leibler divergence
        if self.log_target:
            div = self.kl_div(p, q) + self.kl_div(q, p)
        else:
            # Can't use log_target because of early torch version
            div = self.kl_div(p, torch.exp(q)) + self.kl_div(q, torch.exp(p))

        return torch.tensor(self.alpha * 0.5 * div)
Computes the CO2 regularization term for two model outputs.

        Args:
            out0:
                Output projections of the first set of transformed images.
            out1:
                Output projections of the second set of transformed images.

        Returns:
            The regularization term multiplied by the weight factor alpha.
        
lightly/loss/regularizer/co2.py