class_docstr: ## Configurations
  
  This extends MNIST configurations to get the data loaders and Training and validation loop
  configurations to simplify our implementation.
class_docstr_tok: ["#","#","Configurations","This","extends","MNIST","configurations","to","get","the","data","loaders","and","Training","and","validation","loop","configurations","to","simplify","our","implementation","."]
docstr: Calculate discriminator loss
docstr_tok: ["Calculate","discriminator","loss"]
code: def calc_discriminator_loss(self, data):
      """
      Calculate discriminator loss
      """
      latent = self.sample_z(data.shape[0])
      logits_true = self.discriminator(data)
      logits_false = self.discriminator(self.generator(latent).detach())
      loss_true, loss_false = self.discriminator_loss(
          logits_true, logits_false
      )
      loss = loss_true + loss_false
  
      # Log stuff
      tracker.add("loss.discriminator.true.", loss_true)
      tracker.add("loss.discriminator.false.", loss_false)
      tracker.add("loss.discriminator.", loss)
  
      return loss
  
imports: from typing import Any
  import torch
  import torch.nn
  import torch.utils.data
  from torchvision import transforms
  from labml import tracker, monit, experiment
  from labml.configs import option, calculate
  from labml_helpers.datasets.mnist import MNISTConfigs
  from labml_helpers.device import DeviceConfigs
  from labml_helpers.module import Module
  from labml_helpers.optimizer import OptimizerConfigs
  from labml_helpers.train_valid import TrainValidConfigs, hook_model_outputs, BatchIndex
  from labml_nn.gan.original import DiscriminatorLogitsLoss, GeneratorLogitsLoss
label_desc: Use image node_id 4 for calling the Configs obj's underlying member method code with example usage: obj.calc_discriminator_loss(data) and returns: loss