def __call__(self, Dreal, Dfake):
        """Calculate loss given Discriminator's output and grount truth labels."""
        if self.which_net == 'G':
            return self.G_loss(Dreal, Dfake)
        elif self.which_net == 'D':
            return self.D_loss(Dreal, Dfake)
        else:
            raise NotImplementedError('which_net name [%s] is not recognized' % self.which_net)
Calculate loss given Discriminator's output and grount truth labels.
utils/gan_loss.py