(self, output_real, output_fake)
return errD
r"""
        Computes GAN loss for discriminator.

        Args:
            output_real (Tensor): A batch of output logits of shape (N, 1) from real images.
            output_fake (Tensor): A batch of output logits of shape (N, 1) from fake images.

        Returns:
            errD (Tensor): A batch of GAN losses for the discriminator.
r"""
        Computes GAN loss for discriminator.
r Computes GAN loss for discriminator .
def compute_gan_loss(self, output_real, output_fake):
        r"""
        Computes GAN loss for discriminator.

        Args:
            output_real (Tensor): A batch of output logits of shape (N, 1) from real images.
            output_fake (Tensor): A batch of output logits of shape (N, 1) from fake images.

        Returns:
            errD (Tensor): A batch of GAN losses for the discriminator.
        """
        # Compute loss for D
        if self.loss_type == "gan" or self.loss_type == "ns":
            errD = losses.minimax_loss_dis(output_fake=output_fake,
                                           output_real=output_real)

        elif self.loss_type == "wasserstein":
            errD = losses.wasserstein_loss_dis(output_fake=output_fake,
                                               output_real=output_real)

        else:
            raise ValueError("Invalid loss_type selected.")

        return errD
def compute_gan_loss ( self , output_real , output_fake ) : # Compute loss for D if self . loss_type == "gan" or self . loss_type == "ns" : errD = losses . minimax_loss_dis ( output_fake = output_fake , output_real = output_real ) elif self . loss_type == "wasserstein" : errD = losses . wasserstein_loss_dis ( output_fake = output_fake , output_real = output_real ) else : raise ValueError ( "Invalid loss_type selected." ) return errD