How to use the torchgan.losses.functional.boundary_equilibrium_discriminator_loss function in torchgan

To help you get started, we’ve selected a few torchgan examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github torchgan / torchgan / torchgan / losses / boundaryequilibrium.py View on Github external
def forward(self, dx, dgz):
        r"""Computes the loss for the given input.

        Args:
            dx (torch.Tensor) : Output of the Discriminator with real data. It must have the
                                dimensions (N, \*) where \* means any number of additional
                                dimensions.
            dgz (torch.Tensor) : Output of the Discriminator with generated data. It must have the
                                 dimensions (N, \*) where \* means any number of additional
                                 dimensions.

        Returns:
            A tuple of 3 loss values, namely the ``total loss``, ``loss due to real data`` and ``loss
            due to fake data``.
        """
        return boundary_equilibrium_discriminator_loss(dx, dgz, self.k, self.reduction)