class_docstr: FastFlow.
  
  Unsupervised Anomaly Detection and Localization via 2D Normalizing Flows.
  
  Args:
      input_size (tuple[int, int]): Model input size.
      backbone (str): Backbone CNN network
      pre_trained (bool, optional): Boolean to check whether to use a pre_trained backbone.
      flow_steps (int, optional): Flow steps.
      conv3x3_only (bool, optinoal): Use only conv3x3 in fast_flow model. Defaults to False.
      hidden_ratio (float, optional): Ratio to calculate hidden var channels. Defaults to 1.0.
  
  Raises:
      ValueError: When the backbone is not supported.
class_docstr_tok: ["FastFlow",".","Unsupervised","Anomaly","Detection","and","Localization","via","2D","Normalizing","Flows",".","Args",":","input_size","(","tuple","[","int",",","int","]",")",":","Model","input","size",".","backbone","(","str",")",":","Backbone","CNN","network","pre_trained","(","bool",",","optional",")",":","Boolean","to","check","whether","to","use","a","pre_trained","backbone",".","flow_steps","(","int",",","optional",")",":","Flow","steps",".","conv3x3_only","(","bool",",","optinoal",")",":","Use","only","conv3x3","in","fast_flow","model",".","Defaults","to","False",".","hidden_ratio","(","float",",","optional",")",":","Ratio","to","calculate","hidden","var","channels",".","Defaults","to","1.0",".","Raises",":","ValueError",":","When","the","backbone","is","not","supported","."]
docstr: Forward-Pass the input to the FastFlow Model.
  
  Args:
      input_tensor (Tensor): Input tensor.
  
  Returns:
      Tensor | list[Tensor] | tuple[list[Tensor]]: During training, return
          (hidden_variables, log-of-the-jacobian-determinants).
          During the validation/test, return the anomaly map.
docstr_tok: ["Forward-Pass","the","input","to","the","FastFlow","Model",".","Args",":","input_tensor","(","Tensor",")",":","Input","tensor",".","Returns",":","Tensor","|","list","[","Tensor","]","|","tuple","[","list","[","Tensor","]","]",":","During","training",",","return","(","hidden_variables",",","log-of-the-jacobian-determinants",")",".","During","the","validation\/test",",","return","the","anomaly","map","."]
code: def forward(
      self, input_tensor: Tensor
  ) -> Tensor | list[Tensor] | tuple[list[Tensor]]:
      """Forward-Pass the input to the FastFlow Model.
  
      Args:
          input_tensor (Tensor): Input tensor.
  
      Returns:
          Tensor | list[Tensor] | tuple[list[Tensor]]: During training, return
              (hidden_variables, log-of-the-jacobian-determinants).
              During the validation/test, return the anomaly map.
      """
  
      return_val: Tensor | list[Tensor] | tuple[list[Tensor]]
  
      self.feature_extractor.eval()
      if isinstance(self.feature_extractor, VisionTransformer):
          features = self._get_vit_features(input_tensor)
      elif isinstance(self.feature_extractor, Cait):
          features = self._get_cait_features(input_tensor)
      else:
          features = self._get_cnn_features(input_tensor)
  
      # Compute the hidden variable f: X -> Z and log-likelihood of the jacobian
      # (See Section 3.3 in the paper.)
      # NOTE: output variable has z, and jacobian tuple for each fast-flow blocks.
      hidden_variables: list[Tensor] = []
      log_jacobians: list[Tensor] = []
      for fast_flow_block, feature in zip(
          self.fast_flow_blocks, features
      ):
          hidden_variable, log_jacobian = fast_flow_block(feature)
          hidden_variables.append(hidden_variable)
          log_jacobians.append(log_jacobian)
  
      return_val = (hidden_variables, log_jacobians)
  
      if not self.training:
          return_val = self.anomaly_map_generator(hidden_variables)
  
      return return_val
  
file_path: anomalib/src/anomalib/models/fastflow/torch_model.py
imports: from __future__ import annotations
  from typing import Callable
  import timm
  import torch
  from FrEIA.framework import SequenceINN
  from timm.models.cait import Cait
  from timm.models.vision_transformer import VisionTransformer
  from torch import Tensor, nn
  from anomalib.models.components.flow import AllInOneBlock
  from anomalib.models.fastflow.anomaly_map import AnomalyMapGenerator
label_desc: Use image node_id 2 for calling the FastflowModel obj's underlying member method code with example usage: obj.forward(input_tensor) and returns: return_val