fchollet / deep-learning-with-python-notebooks

Jupyter notebooks for the code samples of the book "Deep Learning with Python"
MIT License
18.61k stars 8.63k forks source link

5.4-visualizing-what-convnets-learn #143

Open prateekvyas1996 opened 4 years ago

prateekvyas1996 commented 4 years ago

There is a problem in code number 13 where K.gradients is used it should be modified with tf.GradientTape

sinano1107 commented 3 years ago

I'm struggling with this problem. Could you please tell me how I can change my code using GradientTape?

rredondoo commented 3 years ago

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()