class_docstr: Ganomaly Model.
  
  Args:
      input_size (tuple[int, int]): Input dimension.
      num_input_channels (int): Number of input channels.
      n_features (int): Number of features layers in the CNNs.
      latent_vec_size (int): Size of autoencoder latent vector.
      extra_layers (int, optional): Number of extra layers for encoder/decoder. Defaults to 0.
      add_final_conv_layer (bool, optional): Add convolution layer at the end. Defaults to True.
class_docstr_tok: ["Ganomaly","Model",".","Args",":","input_size","(","tuple","[","int",",","int","]",")",":","Input","dimension",".","num_input_channels","(","int",")",":","Number","of","input","channels",".","n_features","(","int",")",":","Number","of","features","layers","in","the","CNNs",".","latent_vec_size","(","int",")",":","Size","of","autoencoder","latent","vector",".","extra_layers","(","int",",","optional",")",":","Number","of","extra","layers","for","encoder\/decoder",".","Defaults","to","0.","add_final_conv_layer","(","bool",",","optional",")",":","Add","convolution","layer","at","the","end",".","Defaults","to","True","."]
docstr: Get scores for batch.
  
  Args:
      batch (Tensor): Images
  
  Returns:
      Tensor: Regeneration scores.
docstr_tok: ["Get","scores","for","batch",".","Args",":","batch","(","Tensor",")",":","Images","Returns",":","Tensor",":","Regeneration","scores","."]
code: def forward(
      self, batch: Tensor
  ) -> tuple[Tensor, Tensor, Tensor, Tensor] | Tensor:
      """Get scores for batch.
  
      Args:
          batch (Tensor): Images
  
      Returns:
          Tensor: Regeneration scores.
      """
      padded_batch = pad_nextpow2(batch)
      fake, latent_i, latent_o = self.generator(padded_batch)
      if self.training:
          return padded_batch, fake, latent_i, latent_o
      return torch.mean(
          torch.pow((latent_i - latent_o), 2), dim=1
      ).view(-1)
  
imports: from __future__ import annotations
  import math
  import torch
  from torch import Tensor, nn
  from anomalib.data.utils.image import pad_nextpow2
label_desc: Use image node_id 3 for calling the GanomalyModel obj's underlying member method code with example usage: obj.forward(batch) and returns: torch, padded_batch,  fake,  latent_i,  latent_o