class_docstr: STFPM: Student-Teacher Feature Pyramid Matching for Unsupervised Anomaly Detection.
  
  Args:
      layers (list[str]): Layers used for feature extraction
      input_size (tuple[int, int]): Input size for the model.
      backbone (str, optional): Pre-trained model backbone. Defaults to "resnet18".
docstr: Forward-pass images into the network.
  
  During the training mode the model extracts the features from the teacher and student networks.
  During the evaluation mode, it returns the predicted anomaly map.
  
  Args:
    images (Tensor): Batch of images.
  
  Returns:
    Teacher and student features when in training mode, otherwise the predicted anomaly maps.
code: def forward(
      self, images: Tensor
  ) -> Tensor | dict[str, Tensor] | tuple[dict[str, Tensor]]:
      """Forward-pass images into the network.
  
      During the training mode the model extracts the features from the teacher and student networks.
      During the evaluation mode, it returns the predicted anomaly map.
  
      Args:
        images (Tensor): Batch of images.
  
      Returns:
        Teacher and student features when in training mode, otherwise the predicted anomaly maps.
      """
      if self.tiler:
          images = self.tiler.tile(images)
      teacher_features: dict[str, Tensor] = self.teacher_model(images)
      student_features: dict[str, Tensor] = self.student_model(images)
  
      if self.tiler:
          for layer, data in teacher_features.items():
              teacher_features[layer] = self.tiler.untile(data)
          for layer, data in student_features.items():
              student_features[layer] = self.tiler.untile(data)
  
      if self.training:
          output = teacher_features, student_features
      else:
          output = self.anomaly_map_generator(
              teacher_features=teacher_features,
              student_features=student_features,
          )
  
      return output
  
file_path: anomalib/src/anomalib/models/stfpm/torch_model.py
imports: from __future__ import annotations
  from torch import Tensor, nn
  from anomalib.models.components import FeatureExtractor
  from anomalib.models.stfpm.anomaly_map import AnomalyMapGenerator
  from anomalib.pre_processing import Tiler
label_desc: Use image node_id 2 for calling the STFPMModel obj's underlying member method code with example usage: obj.forward(images) and returns: output