0

I have been trying to use CleverHans (https://github.com/tensorflow/cleverhans).

Background

I ran this file here - https://github.com/tensorflow/cleverhans/blob/master/cleverhans_tutorials/mnist_tutorial_tf.py, with Python 3.7.6 and TensorFlow 1.15.3, which led me to the following error:

ImportError: This version of TensorFlow Addons requires TensorFlow version >= 2; Detected an installation of version 1.15.3. Please upgrade TensorFlow to proceed.

However, CleverHans isn't really meant for TensorFlow's versions 2 and above, and they are working on publishing a new version. I actually even updated TensorFlow to 2.3.0 just to see what would happen. That led to a bunch of errors and error-fixing, and finally I got here:

/python3.7/site-packages/cleverhans/initializers.py", line 13, in __init__
super(HeReLuNormalInitializer, self).__init__(dtype=dtype)
TypeError: __init__() got an unexpected keyword argument 'dtype'

Clearly, CleverHans doesn't work with TensorFlow 2.

Question

My question is that how come the fgsm.py file (CleverHans) uses tensorflow_addons when tensorflow_addons doesn't work with TensorFlow <2. Also, I guess the only solution would be to make things work without tensorflow_addons, but I'm not sure how much effort would that be.

Any suggestions related to evading TensorFlow Addons or a completely new approach would be awesome.

Thanks!

  • It probably uses an older version of tensorflow_addons that does not require TensorFlow 2.0 – Dr. Snoopy Sep 15 '20 at 09:30
  • tensorflow_addons was added only in tf 2: https://medium.com/tensorflow/introducing-tensorflow-addons-6131a50a3dcf. So, it does require tf 2. Also, I believe the problem should be way simpler to fix. Look at this colab (where I've setup the same situation): https://colab.research.google.com/drive/1VqtncL3SD8v-DbhmpbdiUQcD3XK_ajG5?usp=sharing. I don't know why simply importing something from cleverhans isn't possible. The cleverhans team should certainly update the repo (rather fix the repo), as it is pretty much useless in its current form. – Pushpak Raj Gautam Sep 27 '20 at 00:00

0 Answers0