As shown in the previous section, the Discriminator's output is linear because the loss function we are going to use applies the nonlinearity for us. To implement the adversarial training process by following the original formulation, the loss function to use is binary cross-entropy:
(tf2)
bce = tf.keras.losses.BinaryCrossentropy(from_logits=True)
The bce object is used to compute the binary cross-entropy between two distributions:
- The learned distribution, which is represented by the Discriminator's output, is squashed into the [0,1] range (by applying it the sigmoid function, since the from_logits parameter is ...