class_docstr: PL Lightning Module for the STFPM algorithm.
  
  Args:
      input_size (tuple[int, int]): Size of the model input.
      backbone (str): Backbone CNN network
      layers (list[str]): Layers to extract features from the backbone CNN
class_docstr_tok: ["PL","Lightning","Module","for","the","STFPM","algorithm",".","Args",":","input_size","(","tuple","[","int",",","int","]",")",":","Size","of","the","model","input",".","backbone","(","str",")",":","Backbone","CNN","network","layers","(","list","[","str","]",")",":","Layers","to","extract","features","from","the","backbone","CNN"]
docstr: Training Step of STFPM.
  
  For each batch, teacher and student and teacher features are extracted from the CNN.
  
  Args:
    batch (dict[str, str | Tensor]): Input batch
  
  Returns:
    Loss value
docstr_tok: ["Training","Step","of","STFPM",".","For","each","batch",",","teacher","and","student","and","teacher","features","are","extracted","from","the","CNN",".","Args",":","batch","(","dict","[","str",",","str","|","Tensor","]",")",":","Input","batch","Returns",":","Loss","value"]
code: def training_step(
      self, batch: dict[str, str | Tensor], *args, **kwargs
  ) -> STEP_OUTPUT:
      """Training Step of STFPM.
  
      For each batch, teacher and student and teacher features are extracted from the CNN.
  
      Args:
        batch (dict[str, str | Tensor]): Input batch
  
      Returns:
        Loss value
      """
      del args, kwargs  # These variables are not used.
  
      self.model.teacher_model.eval()
      teacher_features, student_features = self.model.forward(
          batch["image"]
      )
      loss = self.loss(teacher_features, student_features)
      self.log(
          "train_loss",
          loss.item(),
          on_epoch=True,
          prog_bar=True,
          logger=True,
      )
      return {"loss": loss}
  
file_path: anomalib/src/anomalib/models/stfpm/lightning_model.py
imports: from __future__ import annotations
  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, optim
  from anomalib.models.components import AnomalyModule
  from anomalib.models.stfpm.loss import STFPMLoss
  from anomalib.models.stfpm.torch_model import STFPMModel
label_desc: Use image node_id 2 for calling the Stfpm obj's underlying member method code with example usage: obj.training_step(batch) and returns: dict