class_docstr: Model for the DFM algorithm.
  
  Args:
      backbone (str): Pre-trained model backbone.
      layer (str): Layer from which to extract features.
      input_size (tuple[int, int]): Input size for the model.
      pre_trained (bool, optional): Boolean to check whether to use a pre_trained backbone.
      pooling_kernel_size (int, optional): Kernel size to pool features extracted from the CNN.
      n_comps (float, optional): Ratio from which number of components for PCA are calculated. Defaults to 0.97.
      score_type (str, optional): Scoring type. Options are `fre` and `nll`. Defaults to "fre". Anomaly
      segmentation is supported with `fre` only. If using `nll`, set `task` in config.yaml to classification
class_docstr_tok: ["Model","for","the","DFM","algorithm",".","Args",":","backbone","(","str",")",":","Pre-trained","model","backbone",".","layer","(","str",")",":","Layer","from","which","to","extract","features",".","input_size","(","tuple","[","int",",","int","]",")",":","Input","size","for","the","model",".","pre_trained","(","bool",",","optional",")",":","Boolean","to","check","whether","to","use","a","pre_trained","backbone",".","pooling_kernel_size","(","int",",","optional",")",":","Kernel","size","to","pool","features","extracted","from","the","CNN",".","n_comps","(","float",",","optional",")",":","Ratio","from","which","number","of","components","for","PCA","are","calculated",".","Defaults","to","0.97.","score_type","(","str",",","optional",")",":","Scoring","type",".","Options","are","`","fre","`","and","`","nll","`",".","Defaults","to","``","fre","''",".","Anomaly","segmentation","is","supported","with","`","fre","`","only",".","If","using","`","nll","`",",","set","`","task","`","in","config.yaml","to","classification"]
docstr: Computer score from input images.
  
  Args:
      batch (Tensor): Input images
  
  Returns:
      Tensor: Scores
docstr_tok: ["Computer","score","from","input","images",".","Args",":","batch","(","Tensor",")",":","Input","images","Returns",":","Tensor",":","Scores"]
code: def forward(self, batch: Tensor) -> Tensor:
      """Computer score from input images.
  
      Args:
          batch (Tensor): Input images
  
      Returns:
          Tensor: Scores
      """
      feature_vector, feature_shapes = self.get_features(batch)
      return self.score(
          feature_vector.view(feature_vector.shape[:2]), feature_shapes
      )
  
file_path: anomalib/src/anomalib/models/dfm/torch_model.py
imports: from __future__ import annotations
  import math
  import torch
  import torch.nn.functional
  from torch import Tensor, nn
  from anomalib.models.components import PCA, DynamicBufferModule, FeatureExtractor
label_desc: Use image node_id 5 for calling the DFMModel obj's underlying member method code with example usage: obj.forward(batch) and returns: self