class_docstr: DRAEM PyTorch model consisting of the reconstructive and discriminative sub networks.
class_docstr_tok: ["DRAEM","PyTorch","model","consisting","of","the","reconstructive","and","discriminative","sub","networks","."]
docstr: Compute the reconstruction and anomaly mask from an input image.
  
  Args:
      x (Tensor): batch of input images
  
  Returns:
      Predicted confidence values of the anomaly mask. During training the reconstructed input images are
      returned as well.
docstr_tok: ["Compute","the","reconstruction","and","anomaly","mask","from","an","input","image",".","Args",":","x","(","Tensor",")",":","batch","of","input","images","Returns",":","Predicted","confidence","values","of","the","anomaly","mask",".","During","training","the","reconstructed","input","images","are","returned","as","well","."]
code: def forward(self, batch: Tensor) -> Tensor | tuple[Tensor, Tensor]:
      """Compute the reconstruction and anomaly mask from an input image.
  
      Args:
          x (Tensor): batch of input images
  
      Returns:
          Predicted confidence values of the anomaly mask. During training the reconstructed input images are
          returned as well.
      """
      reconstruction = self.reconstructive_subnetwork(batch)
      concatenated_inputs = torch.cat([batch, reconstruction], axis=1)
      prediction = self.discriminative_subnetwork(concatenated_inputs)
      if self.training:
          return reconstruction, prediction
      return torch.softmax(prediction, dim=1)[:, 1, ...]
  
imports: from __future__ import annotations
  import torch
  from torch import Tensor, nn
  from anomalib.models.components.layers import SSPCAB
label_desc: Use image node_id 2 for calling the DraemModel obj's underlying member method code with example usage: obj.forward(batch) and returns: torch, reconstruction,  prediction