def forward(
        self,
        input_image: torch.Tensor,
        reconstruction: torch.Tensor,
        anomaly_mask: torch.Tensor,
        prediction: torch.Tensor,
    ) -> torch.Tensor:
        """Compute the combined loss over a batch for the DRAEM model.

        Args:
            input_image: Original input images of shape
                ``(batch_size, num_channels, height, width)``
            reconstruction: Reconstructed images from the model of shape
                ``(batch_size, num_channels, height, width)``
            anomaly_mask: Ground truth anomaly masks of shape
                ``(batch_size, 1, height, width)``
            prediction: Model predictions of shape
                ``(batch_size, num_classes, height, width)``

        Returns:
            torch.Tensor: Combined loss value
        """
        l2_loss_val = self.l2_loss(reconstruction, input_image)
        focal_loss_val = self.focal_loss(prediction, anomaly_mask.squeeze(1).long())
        ssim_loss_val = self.ssim_loss(reconstruction, input_image) * 2
        return l2_loss_val + ssim_loss_val + focal_loss_val
Compute the combined loss over a batch for the DRAEM model.

        Args:
            input_image: Original input images of shape
                ``(batch_size, num_channels, height, width)``
            reconstruction: Reconstructed images from the model of shape
                ``(batch_size, num_channels, height, width)``
            anomaly_mask: Ground truth anomaly masks of shape
                ``(batch_size, 1, height, width)``
            prediction: Model predictions of shape
                ``(batch_size, num_classes, height, width)``

        Returns:
            torch.Tensor: Combined loss value
        
src/anomalib/models/image/draem/loss.py