class_docstr: Component to perform the perceptual evaluation with TorchVision models.
  Currently, only ResNet50 is supported. The network structure is based on:
  https://pytorch.org/vision/main/models/generated/torchvision.models.resnet50.html
  
  Args:
      net: {``"resnet50"``}
          Specifies the network architecture to use. Defaults to ``"resnet50"``.
      pretrained: whether to load pretrained weights. Defaults to `True`.
      pretrained_path: if `pretrained` is `True`, users can specify a weights file to be loaded
          via using this argument. Defaults to `None`.
      pretrained_state_dict_key: if `pretrained_path` is not `None`, this argument is used to
          extract the expected state dict. Defaults to `None`.
docstr: We expect that the input is normalised between [0, 1]. Given the preprocessing performed during the training at
  https://pytorch.org/vision/main/models/generated/torchvision.models.resnet50.html#torchvision.models.ResNet50_Weights,
  we make sure that the input and target have 3 channels, and then do Z-Score normalization.
  The outputs are normalised across the channels, and we obtain the mean from the spatial dimensions (similar
  approach to the lpips package).
docstr_tok: ["We","expect","that","the","input","is","normalised","between","[","0",",","1","]",".","Given","the","preprocessing","performed","during","the","training","at","https",":","\/\/pytorch.org\/vision\/main\/models\/generated\/torchvision.models.resnet50.html","#","torchvision.models.ResNet50_Weights",",","we","make","sure","that","the","input","and","target","have","3","channels",",","and","then","do","Z-Score","normalization",".","The","outputs","are","normalised","across","the","channels",",","and","we","obtain","the","mean","from","the","spatial","dimensions","(","similar","approach","to","the","lpips","package",")","."]
code: def forward(
      self, input: torch.Tensor, target: torch.Tensor
  ) -> torch.Tensor:
      """
      We expect that the input is normalised between [0, 1]. Given the preprocessing performed during the training at
      https://pytorch.org/vision/main/models/generated/torchvision.models.resnet50.html#torchvision.models.ResNet50_Weights,
      we make sure that the input and target have 3 channels, and then do Z-Score normalization.
      The outputs are normalised across the channels, and we obtain the mean from the spatial dimensions (similar
      approach to the lpips package).
      """
      # If input has just 1 channel, repeat channel to have 3 channels
      if input.shape[1] == 1 and target.shape[1] == 1:
          input = input.repeat(1, 3, 1, 1)
          target = target.repeat(1, 3, 1, 1)
  
      # Input normalization
      input = torchvision_zscore_norm(input)
      target = torchvision_zscore_norm(target)
  
      # Get model outputs
      outs_input = self.model.forward(input)[self.final_layer]
      outs_target = self.model.forward(target)[self.final_layer]
  
      # Normalise through the channels
      feats_input = normalize_tensor(outs_input)
      feats_target = normalize_tensor(outs_target)
  
      results: torch.Tensor = (feats_input - feats_target) ** 2
      results = spatial_average(
          results.sum(dim=1, keepdim=True), keepdim=True
      )
  
      return results
  
imports: from __future__ import annotations
  import warnings
  import torch
  import torch.nn
  from monai.utils import optional_import
  from monai.utils.enums import StrEnum
label_desc: Use image node_id 2 for calling the TorchvisionModelPerceptualSimilarity obj's underlying member method code with example usage: obj.forward(input, target) and returns: results