class_docstr: Padim Module.
  
  Args:
      input_size (tuple[int, int]): Input size for the model.
      layers (list[str]): Layers used for feature extraction
      backbone (str, optional): Pre-trained model backbone. Defaults to "resnet18".
      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","Module",".","Args",":","input_size","(","tuple","[","int",",","int","]",")",":","Input","size","for","the","model",".","layers","(","list","[","str","]",")",":","Layers","used","for","feature","extraction","backbone","(","str",",","optional",")",":","Pre-trained","model","backbone",".","Defaults","to","``","resnet18","''",".","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: Forward-pass image-batch (N, C, H, W) into model to extract features.
  
  Args:
      input_tensor: Image-batch (N, C, H, W)
      input_tensor: Tensor:
  
  Returns:
      Features from single/multiple layers.
  
  Example:
      >>> x = torch.randn(32, 3, 224, 224)
      >>> features = self.extract_features(input_tensor)
      >>> features.keys()
      dict_keys(['layer1', 'layer2', 'layer3'])
  
      >>> [v.shape for v in features.values()]
      [torch.Size([32, 64, 56, 56]),
      torch.Size([32, 128, 28, 28]),
      torch.Size([32, 256, 14, 14])]
docstr_tok: ["Forward-pass","image-batch","(","N",",","C",",","H",",","W",")","into","model","to","extract","features",".","Args",":","input_tensor",":","Image-batch","(","N",",","C",",","H",",","W",")","input_tensor",":","Tensor",":","Returns",":","Features","from","single\/multiple","layers",".","Example",":",">",">",">","x","=","torch.randn","(","32",",","3",",","224",",","224",")",">",">",">","features","=","self.extract_features","(","input_tensor",")",">",">",">","features.keys","(",")","dict_keys","(","[","'layer1","'",",","'layer2","'",",","'layer3","'","]",")",">",">",">","[","v.shape","for","v","in","features.values","(",")","]","[","torch.Size","(","[","32",",","64",",","56",",","56","]",")",",","torch.Size","(","[","32",",","128",",","28",",","28","]",")",",","torch.Size","(","[","32",",","256",",","14",",","14","]",")","]"]
code: def forward(self, input_tensor: Tensor) -> Tensor:
      """Forward-pass image-batch (N, C, H, W) into model to extract features.
  
      Args:
          input_tensor: Image-batch (N, C, H, W)
          input_tensor: Tensor:
  
      Returns:
          Features from single/multiple layers.
  
      Example:
          >>> x = torch.randn(32, 3, 224, 224)
          >>> features = self.extract_features(input_tensor)
          >>> features.keys()
          dict_keys(['layer1', 'layer2', 'layer3'])
  
          >>> [v.shape for v in features.values()]
          [torch.Size([32, 64, 56, 56]),
          torch.Size([32, 128, 28, 28]),
          torch.Size([32, 256, 14, 14])]
      """
  
      if self.tiler:
          input_tensor = self.tiler.tile(input_tensor)
  
      with torch.no_grad():
          features = self.feature_extractor(input_tensor)
          embeddings = self.generate_embedding(features)
  
      if self.tiler:
          embeddings = self.tiler.untile(embeddings)
  
      if self.training:
          output = embeddings
      else:
          output = self.anomaly_map_generator(
              embedding=embeddings,
              mean=self.gaussian.mean,
              inv_covariance=self.gaussian.inv_covariance,
          )
      return output
  
file_path: anomalib/src/anomalib/models/padim/torch_model.py
imports: from __future__ import annotations
  from random import sample
  import torch
  import torch.nn.functional
  from torch import Tensor, nn
  from anomalib.models.components import FeatureExtractor, MultiVariateGaussian
  from anomalib.models.components.feature_extractors import dryrun_find_featuremap_dims
  from anomalib.models.padim.anomaly_map import AnomalyMapGenerator
  from anomalib.pre_processing import Tiler
label_desc: Use image node_id 2 for calling the PadimModel obj's underlying member method code with example usage: obj.forward(input_tensor) and returns: output