class_docstr: PL Lightning Module for the GANomaly Algorithm.
  
  Args:
      batch_size (int): Batch size.
      input_size (tuple[int, int]): Input dimension.
      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.
      wadv (int, optional): Weight for adversarial loss. Defaults to 1.
      wcon (int, optional): Image regeneration weight. Defaults to 50.
      wenc (int, optional): Latent vector encoder weight. Defaults to 1.
class_docstr_tok: ["PL","Lightning","Module","for","the","GANomaly","Algorithm",".","Args",":","batch_size","(","int",")",":","Batch","size",".","input_size","(","tuple","[","int",",","int","]",")",":","Input","dimension",".","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",".","wadv","(","int",",","optional",")",":","Weight","for","adversarial","loss",".","Defaults","to","1.","wcon","(","int",",","optional",")",":","Image","regeneration","weight",".","Defaults","to","50.","wenc","(","int",",","optional",")",":","Latent","vector","encoder","weight",".","Defaults","to","1","."]
code: def __init__(
      self,
      batch_size: int,
      input_size: tuple[int, int],
      n_features: int,
      latent_vec_size: int,
      extra_layers: int = 0,
      add_final_conv_layer: bool = True,
      wadv: int = 1,
      wcon: int = 50,
      wenc: int = 1,
      lr: float = 0.0002,
      beta1: float = 0.5,
      beta2: float = 0.999,
  ) -> None:
      super().__init__()
  
      self.model: GanomalyModel = GanomalyModel(
          input_size=input_size,
          num_input_channels=3,
          n_features=n_features,
          latent_vec_size=latent_vec_size,
          extra_layers=extra_layers,
          add_final_conv_layer=add_final_conv_layer,
      )
  
      self.real_label = torch.ones(
          size=(batch_size,), dtype=torch.float32
      )
      self.fake_label = torch.zeros(
          size=(batch_size,), dtype=torch.float32
      )
  
      self.min_scores: Tensor = torch.tensor(
          float("inf"), dtype=torch.float32
      )  # pylint: disable=not-callable
      self.max_scores: Tensor = torch.tensor(
          float("-inf"), dtype=torch.float32
      )  # pylint: disable=not-callable
  
      self.generator_loss = GeneratorLoss(wadv, wcon, wenc)
      self.discriminator_loss = DiscriminatorLoss()
  
      # TODO: LR should be part of optimizer in config.yaml! Since ganomaly has custom
      #   optimizer this is to be addressed later.
      self.learning_rate = lr
      self.beta1 = beta1
      self.beta2 = beta2
  
imports: from __future__ import annotations
  import logging
  import torch
  from omegaconf import DictConfig, ListConfig
  from pytorch_lightning.callbacks import Callback, EarlyStopping
  from pytorch_lightning.utilities.types import EPOCH_OUTPUT, STEP_OUTPUT
  from torch import Tensor, optim
  from anomalib.models.components import AnomalyModule
  from anomalib.models.ganomaly.loss import DiscriminatorLoss, GeneratorLoss
  from .torch_model import GanomalyModel
label_desc: Use image node_id 1 to create a new Ganomaly object from inherited base classes: AnomalyModule with example: obj = Ganomaly(batch_size, input_size, n_features, latent_vec_size, extra_layers, add_final_conv_layer, wadv, wcon, wenc, lr, beta1, beta2)