Beispiel #1
0
    def generative_x_entropy_loss(self, sample_logits, batch_logits):
        sample_loss = losses.sigmoid_cross_entropy_loss(sample_logits, 1.0)
        batch_loss = losses.sigmoid_cross_entropy_loss(batch_logits, 1.0)

        loss = sample_loss  # + batch_loss
        if H.train_batch_logits:
            loss += batch_loss

        wgan_loss = tr.mean(sample_logits)

        return loss
Beispiel #2
0
    def discriminative_x_entropy_loss(self, s_logits_real, s_logits_fake, b_logits_real, b_logits_fake):
        s_loss_real = losses.sigmoid_cross_entropy_loss(s_logits_real, 1.0)
        s_loss_fake = losses.sigmoid_cross_entropy_loss(s_logits_fake, 0.0)
        s_x_entropy_loss = (s_loss_real + s_loss_fake) / 2.0

        b_loss_real = losses.sigmoid_cross_entropy_loss(b_logits_real, 1.0)
        b_loss_fake = losses.sigmoid_cross_entropy_loss(b_logits_fake, 0.0)
        b_x_entropy_loss = (b_loss_real + b_loss_fake) / 2.0

        loss = s_x_entropy_loss  # + batch_x_entropy_loss
        if H.train_batch_logits:
            loss += b_x_entropy_loss

        return loss