import tensorflow as tf

    real_logits = discriminator_fn(real_data)
    if isinstance(real_logits, (list, tuple)):
        real_logits = real_logits[0]
    real_loss = tf.reduce_mean(tf.nn.sigmoid_cross_entropy_with_logits(
        logits=real_logits, labels=tf.ones_like(real_logits)))

    fake_logits = discriminator_fn(fake_data)
    if isinstance(fake_logits, (list, tuple)):
