class_docstr: DRÆM: A discriminatively trained reconstruction embedding for surface anomaly detection.
  
  Args:
      anomaly_source_path (str | None): Path to folder that contains the anomaly source images. Random noise will
          be used if left empty.
class_docstr_tok: ["DR\u00c6M",":","A","discriminatively","trained","reconstruction","embedding","for","surface","anomaly","detection",".","Args",":","anomaly_source_path","(","str","|","None",")",":","Path","to","folder","that","contains","the","anomaly","source","images",".","Random","noise","will","be","used","if","left","empty","."]
docstr: Prepare the model for the SSPCAB training step by adding forward hooks for the SSPCAB layer activations.
docstr_tok: ["Prepare","the","model","for","the","SSPCAB","training","step","by","adding","forward","hooks","for","the","SSPCAB","layer","activations","."]
code: def setup_sspcab(self) -> None:
      """Prepare the model for the SSPCAB training step by adding forward hooks for the SSPCAB layer activations."""
  
      def get_activation(name: str) -> Callable:
          """Retrieves the activations.
  
          Args:
              name (str): Identifier for the retrieved activations.
          """
  
          def hook(_, __, output: Tensor) -> None:
              """Hook for retrieving the activations."""
              self.sspcab_activations[name] = output
  
          return hook
  
      self.model.reconstructive_subnetwork.encoder.mp4.register_forward_hook(
          get_activation("input")
      )
      self.model.reconstructive_subnetwork.encoder.block5.register_forward_hook(
          get_activation("output")
      )
  
imports: from __future__ import annotations
  from typing import Callable
  import torch
  from omegaconf import DictConfig, ListConfig
  from pytorch_lightning.callbacks import EarlyStopping
  from pytorch_lightning.utilities.types import STEP_OUTPUT
  from torch import Tensor, nn
  from anomalib.data.utils import Augmenter
  from anomalib.models.components import AnomalyModule
  from anomalib.models.draem.loss import DraemLoss
  from anomalib.models.draem.torch_model import DraemModel
label_desc: Use image node_id 2 for calling the Draem obj's underlying member method code with example usage: obj.setup_sspcab() and returns: hook