2

In the pull requests, I see that master branch has code which works with TF2. I am looking into how to use them. I use a conda env with python 3.7.7 and tf 2.2. Then I pulled master branch from gihub celverhans. But, when I try to run mnist_tutorial_tfe.py, I get the following error.

$ python ./cleverhans_tutorials/mnist_tutorial_tfe.py Traceback (most recent call last): File "./cleverhans_tutorials/mnist_tutorial_tfe.py", line 23, in <module> from cleverhans.utils_tfe import train, model_eval File "/media/Y/vish/hcraeser/code_repo/cleverhans/cleverhans/utils_tfe.py", line 17, in <module> from cleverhans.loss import LossCrossEntropy File "/media/Y/vish/hcraeser/code_repo/cleverhans/cleverhans/loss.py", line 10, in <module> from cleverhans.attacks import Attack File "/media/Y/vish/hcraeser/code_repo/cleverhans/cleverhans/attacks/__init__.py", line 12, in <module> from cleverhans.attacks.attack import Attack File "/media/Y/vish/hcraeser/code_repo/cleverhans/cleverhans/attacks/attack.py", line 13, in <module> from cleverhans.model import Model File "/media/Y/vish/hcraeser/code_repo/cleverhans/cleverhans/model.py", line 9, in <module> from cleverhans import utils_tf File "/media/Y/vish/hcraeser/code_repo/cleverhans/cleverhans/utils_tf.py", line 345, in <module> loss_collection=tf.GraphKeys.REGULARIZATION_LOSSES): AttributeError: module 'tensorflow' has no attribute 'GraphKeys' 

How can I use cleverhans with TF2? It seems the relevant code is under cleverhans/future directory. But how to make these official examples run under TF2?

1
  • Is your issue resolved now? Else, can you try to import as import tensorflow.compat.v1 as tf and let us know the status ? Commented Oct 23, 2020 at 15:59

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.