def forward(
        self, view0: Tensor, view1: Tensor, mask_view0: Tensor, mask_view1: Tensor
    ) -> Tensor:
        """Calculate the contrastive loss under the same mask in the same image.

        The tensor shapes and value ranges are given by variables :math:`B, M, D, N`,
        where :math:`B` is the batch size, :math:`M` is the sampled number of image
        masks / regions, :math:`D` is the embedding size and :math:`N` is the total
        number of masks.

        Args:
            view0: Mask-pooled output for the first view, a float tensor of shape
                :math:`(B, M, D)`.
            pred_view1: Mask-pooled output for the second view, a float tensor of shape
                :math:`(B, M, D)`.
            mask_view0: Indices corresponding to the sampled masks for the first view,
                an integer tensor of shape :math:`(B, M)` with (possibly repeated)
                indices in the range :math:`[0, N)`.
            mask_view1: Indices corresponding to the sampled masks for the second view,
                an integer tensor of shape (B, M) with (possibly repeated) indices in
                the range :math:`[0, N)`.

        Returns:
            A scalar float tensor containing the contrastive loss.
        """
        loss: Tensor = self.detconbloss(
            view0, view1, view0, view1, mask_view0, mask_view1
        )
        return loss
Calculate the contrastive loss under the same mask in the same image.

        The tensor shapes and value ranges are given by variables :math:`B, M, D, N`,
        where :math:`B` is the batch size, :math:`M` is the sampled number of image
        masks / regions, :math:`D` is the embedding size and :math:`N` is the total
        number of masks.

        Args:
            view0: Mask-pooled output for the first view, a float tensor of shape
                :math:`(B, M, D)`.
            pred_view1: Mask-pooled output for the second view, a float tensor of shape
                :math:`(B, M, D)`.
            mask_view0: Indices corresponding to the sampled masks for the first view,
                an integer tensor of shape :math:`(B, M)` with (possibly repeated)
                indices in the range :math:`[0, N)`.
            mask_view1: Indices corresponding to the sampled masks for the second view,
                an integer tensor of shape (B, M) with (possibly repeated) indices in
                the range :math:`[0, N)`.

        Returns:
            A scalar float tensor containing the contrastive loss.
        
lightly/loss/detcon_loss.py