Trouble Producing Heatmap

Get "AttributeError: module ‘tensorflow.keras.backend’ has no attribute ‘GradientTape’ ". The problem appears to be in the functions of the util folder(compute_gradcam and grad_cam). Also got “RuntimeError: tf.gradients is not supported when eager execution is enabled. Use tf.GradientTape instead.”.

I’m not really what changes i need to make to the utility code to get it to run

Spidey sense says TensorFlow version issue. Anything interesting about where you’re running this?

I’m using tensorflow 2.8.0

1 Like

Where was my question because I’m under the impression that the environment(s) provided by Coursera are running TF v1.x

Are you by any chance trying to run locally?

Hard for me to research because I took the class a long while ago and deeplearning won’t let me access the programming exercises any more. But my guess is you’re running code written in v 1.x in a v 2.8 environment. There are ways to minimize the impact and achieve some automated backwards compatibility, but that doesn’t always work. If your goal is just to complete the class, probably better to run only in the provided cloud environments. If your goal is to get everything running locally, probably best to do a real version migration.