class_docstr: Overall loss function of the second training phase of the DSR model.
  
  The total loss consists of:
      - MSE loss between non-anomalous quantized input image and anomalous subspace-reconstructed
        non-quantized input (hi and lo)
      - MSE loss between input image and reconstructed image through object-specific decoder,
      - Focal loss between computed segmentation mask and ground truth mask.
docstr: Compute the loss over a batch for the DSR model.
  
  Args:
      recon_nq_hi (Tensor): Reconstructed non-quantized hi feature
      recon_nq_lo (Tensor): Reconstructed non-quantized lo feature
      qu_hi (Tensor): Non-defective quantized hi feature
      qu_lo (Tensor): Non-defective quantized lo feature
      input_image (Tensor): Original image
      gen_img (Tensor): Object-specific decoded image
      seg (Tensor): Computed anomaly map
      anomaly_mask (Tensor): Ground truth anomaly map
  
  Returns:
      Tensor: Total loss
code: def forward(
      self,
      recon_nq_hi: Tensor,
      recon_nq_lo: Tensor,
      qu_hi: Tensor,
      qu_lo: Tensor,
      input_image: Tensor,
      gen_img: Tensor,
      seg: Tensor,
      anomaly_mask: Tensor,
  ) -> Tensor:
      """Compute the loss over a batch for the DSR model.
  
      Args:
          recon_nq_hi (Tensor): Reconstructed non-quantized hi feature
          recon_nq_lo (Tensor): Reconstructed non-quantized lo feature
          qu_hi (Tensor): Non-defective quantized hi feature
          qu_lo (Tensor): Non-defective quantized lo feature
          input_image (Tensor): Original image
          gen_img (Tensor): Object-specific decoded image
          seg (Tensor): Computed anomaly map
          anomaly_mask (Tensor): Ground truth anomaly map
  
      Returns:
          Tensor: Total loss
      """
      l2_loss_hi_val = self.l2_loss(recon_nq_hi, qu_hi)
      l2_loss_lo_val = self.l2_loss(recon_nq_lo, qu_lo)
      l2_loss_img_val = self.l2_loss(input_image, gen_img) * 10
      focal_loss_val = self.focal_loss(
          seg, anomaly_mask.squeeze(1).long()
      )
      return (
          l2_loss_hi_val
          + l2_loss_lo_val
          + l2_loss_img_val
          + focal_loss_val
      )
  
file_path: anomalib/src/anomalib/models/dsr/loss.py
imports: from kornia.losses import FocalLoss
  from torch import Tensor, nn
label_desc: Use image node_id 2 for calling the DsrSecondStageLoss obj's underlying member method code with example usage: obj.forward(recon_nq_hi, recon_nq_lo, qu_hi, qu_lo, input_image, gen_img, seg, anomaly_mask) and returns: unknown