class_docstr: Generate Anomaly Heatmap.
docstr: Returns anomaly map.
  
  Expects `teach_features` and `student_features` keywords to be passed explicitly.
  
  Example:
      >>> anomaly_map_generator = AnomalyMapGenerator(image_size=tuple(hparams.model.input_size))
      >>> output = self.anomaly_map_generator(
              teacher_features=teacher_features,
              student_features=student_features
          )
  
  Raises:
      ValueError: `teach_features` and `student_features` keys are not found
  
  Returns:
      torch.Tensor: anomaly map
docstr_tok: ["Returns","anomaly","map",".","Expects","`","teach_features","`","and","`","student_features","`","keywords","to","be","passed","explicitly",".","Example",":",">",">",">","anomaly_map_generator","=","AnomalyMapGenerator","(","image_size=tuple","(","hparams.model.input_size",")",")",">",">",">","output","=","self.anomaly_map_generator","(","teacher_features=teacher_features",",","student_features=student_features",")","Raises",":","ValueError",":","`","teach_features","`","and","`","student_features","`","keys","are","not","found","Returns",":","torch.Tensor",":","anomaly","map"]
code: def forward(self, **kwargs: dict[str, Tensor]) -> torch.Tensor:
      """Returns anomaly map.
  
      Expects `teach_features` and `student_features` keywords to be passed explicitly.
  
      Example:
          >>> anomaly_map_generator = AnomalyMapGenerator(image_size=tuple(hparams.model.input_size))
          >>> output = self.anomaly_map_generator(
                  teacher_features=teacher_features,
                  student_features=student_features
              )
  
      Raises:
          ValueError: `teach_features` and `student_features` keys are not found
  
      Returns:
          torch.Tensor: anomaly map
      """
  
      if not (
          "teacher_features" in kwargs and "student_features" in kwargs
      ):
          raise ValueError(
              f"Expected keys `teacher_features` and `student_features. Found {kwargs.keys()}"
          )
  
      teacher_features: dict[str, Tensor] = kwargs["teacher_features"]
      student_features: dict[str, Tensor] = kwargs["student_features"]
  
      return self.compute_anomaly_map(
          teacher_features, student_features
      )
  
file_path: anomalib/src/anomalib/models/stfpm/anomaly_map.py
imports: from __future__ import annotations
  import torch
  import torch.nn.functional
  from omegaconf import ListConfig
  from torch import Tensor, nn
label_desc: Use image node_id 4 for calling the AnomalyMapGenerator obj's underlying member method code with example usage: obj.forward() and returns: self