class_docstr: PaDiM: a Patch Distribution Modeling Framework for Anomaly Detection and Localization.
  
  Args:
      layers (list[str]): Layers to extract features from the backbone CNN
      input_size (tuple[int, int]): Size of the model input.
      backbone (str): Backbone CNN network
      pre_trained (bool, optional): Boolean to check whether to use a pre_trained backbone.
      n_features (int, optional): Number of features to retain in the dimension reduction step.
                              Default values from the paper are available for: resnet18 (100), wide_resnet50_2 (550).
class_docstr_tok: ["PaDiM",":","a","Patch","Distribution","Modeling","Framework","for","Anomaly","Detection","and","Localization",".","Args",":","layers","(","list","[","str","]",")",":","Layers","to","extract","features","from","the","backbone","CNN","input_size","(","tuple","[","int",",","int","]",")",":","Size","of","the","model","input",".","backbone","(","str",")",":","Backbone","CNN","network","pre_trained","(","bool",",","optional",")",":","Boolean","to","check","whether","to","use","a","pre_trained","backbone",".","n_features","(","int",",","optional",")",":","Number","of","features","to","retain","in","the","dimension","reduction","step",".","Default","values","from","the","paper","are","available","for",":","resnet18","(","100",")",",","wide_resnet50_2","(","550",")","."]
docstr: Training Step of PADIM. For each batch, hierarchical features are extracted from the CNN.
  
  Args:
      batch (dict[str, str | Tensor]): Batch containing image filename, image, label and mask
      _batch_idx: Index of the batch.
  
  Returns:
      Hierarchical feature map
docstr_tok: ["Training","Step","of","PADIM",".","For","each","batch",",","hierarchical","features","are","extracted","from","the","CNN",".","Args",":","batch","(","dict","[","str",",","str","|","Tensor","]",")",":","Batch","containing","image","filename",",","image",",","label","and","mask","_batch_idx",":","Index","of","the","batch",".","Returns",":","Hierarchical","feature","map"]
code: def training_step(
      self, batch: dict[str, str | Tensor], *args, **kwargs
  ) -> None:
      """Training Step of PADIM. For each batch, hierarchical features are extracted from the CNN.
  
      Args:
          batch (dict[str, str | Tensor]): Batch containing image filename, image, label and mask
          _batch_idx: Index of the batch.
  
      Returns:
          Hierarchical feature map
      """
      del args, kwargs  # These variables are not used.
  
      self.model.feature_extractor.eval()
      embedding = self.model(batch["image"])
  
      # NOTE: `self.embedding` appends each batch embedding to
      #   store the training set embedding. We manually append these
      #   values mainly due to the new order of hooks introduced after PL v1.4.0
      #   https://github.com/PyTorchLightning/pytorch-lightning/pull/7357
      self.embeddings.append(embedding.cpu())
  
file_path: anomalib/src/anomalib/models/padim/lightning_model.py
imports: from __future__ import annotations
  import logging
  import torch
  from omegaconf import DictConfig, ListConfig
  from pytorch_lightning.utilities.types import STEP_OUTPUT
  from torch import Tensor
  from anomalib.models.components import AnomalyModule
  from anomalib.models.padim.torch_model import PadimModel
label_desc: Use image node_id 3 for calling the Padim obj's underlying member method code with example usage: obj.training_step(batch) without return types