code: def get_nll_loss(
      self,
      rec_loss: torch.Tensor,
      weights: Optional[Union[float, torch.Tensor]] = None,
  ) -> Tuple[torch.Tensor, torch.Tensor]:
      nll_loss = rec_loss / torch.exp(self.logvar) + self.logvar
      weighted_nll_loss = nll_loss
      if weights is not None:
          weighted_nll_loss = weights * nll_loss
      weighted_nll_loss = (
          torch.sum(weighted_nll_loss) / weighted_nll_loss.shape[0]
      )
      nll_loss = torch.sum(nll_loss) / nll_loss.shape[0]
  
      return nll_loss, weighted_nll_loss
  
imports: from typing import Dict, Iterator, List, Optional, Tuple, Union
  import numpy
  import torch
  import torch.nn
  import torchvision
  from einops import rearrange
  from matplotlib import colormaps
  from matplotlib import pyplot
  from ....util import default, instantiate_from_config
  from ..lpips.loss.lpips import LPIPS
  from ..lpips.model.model import weights_init
  from ..lpips.vqperceptual import hinge_d_loss, vanilla_d_loss
label_desc: Use image node_id 7 for calling the GeneralLPIPSWithDiscriminator obj's underlying member method code with example usage: obj.get_nll_loss(rec_loss, weights) and returns: nll_loss,  weighted_nll_loss