class_docstr:     ## Discriminator Loss
  
      Discriminator should **ascend** on the gradient,
  
      $$
  abla_{  heta_d} rac{1}{m} \sum_{i=1}^m \Bigg[
          \log D\Big(\pmb{x}^{(i)}\Big) +
          \log \Big(1 - D\Big(G\Big(\pmb{z}^{(i)}\Big)\Big)\Big)
      \Bigg]$$
  
      $m$ is the mini-batch size and $(i)$ is used to index samples in the mini-batch.
      $\pmb{x}$ are samples from $p_{data}$ and $\pmb{z}$ are samples from $p_z$.
      
docstr: `logits_true` are logits from $D(\pmb{x}^{(i)})$ and
  `logits_false` are logits from $D(G(\pmb{z}^{(i)}))$
docstr_tok: ["`","logits_true","`","are","logits","from","$","D","(","\\pmb","{","x","}","^","{","(","i",")","}",")","$","and","`","logits_false","`","are","logits","from","$","D","(","G","(","\\pmb","{","z","}","^","{","(","i",")","}",")",")","$"]
code: def forward(
      self, logits_true: torch.Tensor, logits_false: torch.Tensor
  ):
      """
      `logits_true` are logits from $D(\pmb{x}^{(i)})$ and
      `logits_false` are logits from $D(G(\pmb{z}^{(i)}))$
      """
      if len(logits_true) > len(self.labels_true):
          self.register_buffer(
              "labels_true",
              _create_labels(
                  len(logits_true),
                  1.0 - self.smoothing,
                  1.0,
                  logits_true.device,
              ),
              False,
          )
      if len(logits_false) > len(self.labels_false):
          self.register_buffer(
              "labels_false",
              _create_labels(
                  len(logits_false),
                  0.0,
                  self.smoothing,
                  logits_false.device,
              ),
              False,
          )
  
      return (
          self.loss_true(
              logits_true, self.labels_true[: len(logits_true)]
          ),
          self.loss_false(
              logits_false, self.labels_false[: len(logits_false)]
          ),
      )
  
file_path: annotated_deep_learning_paper_implementations/labml_nn/gan/original/__init__.py
imports: import torch
  import torch.nn
  import torch.utils.data
  import torch.utils.data
  from labml_helpers.module import Module
label_desc: Use image node_id 2 for calling the DiscriminatorLogitsLoss obj's underlying member method code with example usage: obj.forward(logits_true, logits_false) and returns: self,  self