PracticalDL / Practical-Deep-Learning-Book

Official code repo for the O'Reilly Book - Practical Deep Learning for Cloud, Mobile & Edge
http://practicaldeeplearning.ai
MIT License
750 stars 314 forks source link

Chapter 2 part 2 sample code #71

Closed josephlandau closed 4 years ago

josephlandau commented 4 years ago

AttributeError Traceback (most recent call last)

in 6 7 from tensorflow.keras.applications.vgg16 import VGG16, preprocess_input ----> 8 from tf_explain.core.grad_cam import GradCAM 9 10 import PIL c:\python\lib\site-packages\tf_explain\__init__.py in 8 __version__ = "0.2.1" 9 ---> 10 from . import core 11 from . import callbacks 12 from . import utils c:\python\lib\site-packages\tf_explain\core\__init__.py in 5 """ 6 from .activations import ExtractActivations ----> 7 from .grad_cam import GradCAM 8 from .gradients_inputs import GradientsInputs 9 from .vanilla_gradients import VanillaGradients c:\python\lib\site-packages\tf_explain\core\grad_cam.py in 10 11 ---> 12 class GradCAM: 13 14 """ c:\python\lib\site-packages\tf_explain\core\grad_cam.py in GradCAM() 90 91 @staticmethod ---> 92 @tf.function 93 def get_gradients_and_filters(model, images, layer_name, class_index): 94 """ AttributeError: module 'tensorflow' has no attribute 'function'
sidgan commented 4 years ago

Can you please try with the following specifications:

tensorflow==2.0.0
tf-explain==0.1.0

What version of python do you have?

ManojKumarTiwari commented 4 years ago

I'm also having the same issue I tried installing the above packages but it still showed the same error. Please help

meherkasam commented 4 years ago

@ManojKumarTiwari Are you running this on Colab or locally on Jupyter? Can you also paste the output of the following command in a comment?

$ pip list

ManojKumarTiwari commented 4 years ago

It worked.. sorry I was running the local version of the notebook instead of the colab version. My bad!! Sorry again. Everything is fine.

meherkasam commented 4 years ago

No worries. Thanks for confirming. I'll resolve the issue now.