class_docstr: Adversary training wrapper.
  
  Args:
      adversary (nn.Module): The adversary module will be used to estimate the logits given the fake and real samples.
          We assume here the adversary output is ``Tuple[List[torch.Tensor], List[List[torch.Tensor]]]``
          where the first item is a list of logits and the second item is a list of feature maps.
      optimizer (torch.optim.Optimizer): Optimizer used for training the given module.
      loss (AdvLossType): Loss function for generator training.
      loss_real (AdvLossType): Loss function for adversarial training on logits from real samples.
      loss_fake (AdvLossType): Loss function for adversarial training on logits from fake samples.
      loss_feat (FeatLossType): Feature matching loss function for generator training.
      normalize (bool): Whether to normalize by number of sub-discriminators.
  
  Example of usage:
      adv_loss = AdversarialLoss(adversaries, optimizer, loss, loss_real, loss_fake)
      for real in loader:
          noise = torch.randn(...)
          fake = model(noise)
          adv_loss.train_adv(fake, real)
          loss, _ = adv_loss(fake, real)
          loss.backward()
class_docstr_tok: ["Adversary","training","wrapper",".","Args",":","adversary","(","nn.Module",")",":","The","adversary","module","will","be","used","to","estimate","the","logits","given","the","fake","and","real","samples",".","We","assume","here","the","adversary","output","is","``","Tuple","[","List","[","torch.Tensor","]",",","List","[","List","[","torch.Tensor","]","]","]","``","where","the","first","item","is","a","list","of","logits","and","the","second","item","is","a","list","of","feature","maps",".","optimizer","(","torch.optim.Optimizer",")",":","Optimizer","used","for","training","the","given","module",".","loss","(","AdvLossType",")",":","Loss","function","for","generator","training",".","loss_real","(","AdvLossType",")",":","Loss","function","for","adversarial","training","on","logits","from","real","samples",".","loss_fake","(","AdvLossType",")",":","Loss","function","for","adversarial","training","on","logits","from","fake","samples",".","loss_feat","(","FeatLossType",")",":","Feature","matching","loss","function","for","generator","training",".","normalize","(","bool",")",":","Whether","to","normalize","by","number","of","sub-discriminators",".","Example","of","usage",":","adv_loss","=","AdversarialLoss","(","adversaries",",","optimizer",",","loss",",","loss_real",",","loss_fake",")","for","real","in","loader",":","noise","=","torch.randn","(","...",")","fake","=","model","(","noise",")","adv_loss.train_adv","(","fake",",","real",")","loss",",","_","=","adv_loss","(","fake",",","real",")","loss.backward","(",")"]
code: def _load_from_state_dict(self, state_dict, prefix, *args, **kwargs):
      # Load optimizer state.
      self.optimizer.load_state_dict(
          state_dict.pop(prefix + "optimizer")
      )
      super()._load_from_state_dict(state_dict, prefix, *args, **kwargs)
  
imports: import typing
  import flashy
  import torch
  import torch.nn
  import torch.nn.functional
label_desc: Use image node_id 3 for calling the AdversarialLoss obj's underlying member method code with example usage: obj._load_from_state_dict(state_dict, prefix) without return types