deep-learning-with-python-notebooks
deep-learning-with-python-notebooks copied to clipboard
5.4-visualizing-what-convnets-learn
There is a problem in code number 13 where K.gradients is used it should be modified with tf.GradientTape
I'm struggling with this problem. Could you please tell me how I can change my code using GradientTape?
I had the same problem. I implemented this answer and it solved the issue.
It suggests adding the following code before calling K.gradients
:
import tensorflow as tf
tf.compat.v1.disable_eager_execution()