eriklindernoren/Keras-GAN

Gradient Penalty Loss: Not working with tf2

pabloi09 opened this issue · 4 comments

Good morning,
The approach of the gradient_penalty_loss in the wgan_gp is not working with tf2. K.gradients returns [None]. You guys can find the issue here:
https://colab.research.google.com/drive/11dcMKoiCigTnEn7QvmjqLNrJdmFztByT
I have been reading some posts and it seems like there is no solution yet. Is there anyone that has already implemented this loss successfully with tf2?
Thank you very much

Good morning,
The approach of the gradient_penalty_loss in the wgan_gp is not working with tf2. K.gradients returns [None]. You guys can find the issue here:
https://colab.research.google.com/drive/11dcMKoiCigTnEn7QvmjqLNrJdmFztByT
I have been reading some posts and it seems like there is no solution yet. Is there anyone that has already implemented this loss successfully with tf2?
Thank you very much

Maybe we can use tf.keras.backend.function to solve the problem. I write a sample version of WGAN-GP Here. It's tested on the newest tf.keras.

Maybe we can use tf.keras.backend.function to solve the problem. I write a sample version of WGAN-GP Here. It's tested on the newest tf.keras.

Hello!

Your solution seems pretty smart. I didn't get to that and I ended doing the models extending tf.keras.Model and using GradientTape. This seems to be the standard now with tf2. The example I followed can be found Here

Maybe we can use tf.keras.backend.function to solve the problem. I write a sample version of WGAN-GP Here. It's tested on the newest tf.keras.

Hello!

Your solution seems pretty smart. I didn't get to that and I ended doing the models extending tf.keras.Model and using GradientTape. This seems to be the standard now with tf2. The example I followed can be found Here

Nice job! I think Keras will add the GradientTape soonly.

can anyone write it with GradientTape?