import tensorflow as tf

    d_loss = real_loss + fake_loss

    if mode == "min_fake":
        g_loss = - fake_loss
    elif mode == "max_real":
        g_loss = tf.reduce_mean(tf.nn.sigmoid_cross_entropy_with_logits(
            logits=fake_logits, labels=tf.ones_like(fake_logits)))
    else:
        raise ValueError("Unknown mode: %s. Only 'min_fake' and 'max_real' "
                         "are allowed.")

    return g_loss, d_loss
