Describe the bug
projected_gradient_descent() gives an error: "TypeError: Cannot convert 0.3 to EagerTensor of dtype uint8" when run on Google Colab.
To Reproduce
Steps to reproduce the behavior:
While running the following code (present in cleverhans/cleverhans/tutorials/tf2/mnist_tutorial.py:
for epoch in range(FLAGS.nb_epochs):
keras like display of progress
progress_bar_train = tf.keras.utils.Progbar(60000)
for (x, y) in data.train:
if FLAGS.adv_train:
# Replace clean example with adversarial example for adversarial training
print('x is ',x.shape)
print('y is ',y.shape)
print('Calling PGD')
#print(eps)
#import pdb; pdb.set_trace()
x = projected_gradient_descent(model, x, 0.3, 0.01, 40, np.inf)
#print(x)
train_step(x, y)
progress_bar_train.add(x.shape[0], values=[("loss", train_loss.result())])
........
projected_gradient_descent() gives the following error:
TypeError Traceback (most recent call last)
in ()
36 #print(eps)
37 #import pdb; pdb.set_trace()
---> 38 x = projected_gradient_descent(model, x, 0.3, 0.01, 40, np.inf)
39 train_step(x, y)
40 progress_bar_train.add(x.shape[0], values=[("loss", train_loss.result())])
4 frames
/usr/local/lib/python3.7/dist-packages/tensorflow/python/ops/gen_math_ops.py in minimum(x, y, name)
5927 try:
5928 _result = pywrap_tfe.TFE_Py_FastPathExecute(
-> 5929 _ctx, "Minimum", name, x, y)
5930 return _result
5931 except _core._NotOkStatusException as e:
TypeError: Cannot convert 0.3 to EagerTensor of dtype uint8
**Expected behavior**
A clear and concise description of what you expected to happen.
eps cannot be of type uint8 and projected_gradient_descent method is not expected to give this error.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**System configuration**
- OS - Linux e2205817a30a 4.19.112+ #1 SMP Thu Jul 23 08:00:38 PDT 2020 x86_64 x86_64 x86_64 GNU/Linux (Google colab notebook)
- Python version - Python 3.7.10
- TensorFlow version - 2.4.1
Describe the bug projected_gradient_descent() gives an error: "TypeError: Cannot convert 0.3 to EagerTensor of dtype uint8" when run on Google Colab.
To Reproduce Steps to reproduce the behavior: While running the following code (present in cleverhans/cleverhans/tutorials/tf2/mnist_tutorial.py: for epoch in range(FLAGS.nb_epochs):
keras like display of progress
........ projected_gradient_descent() gives the following error:
TypeError Traceback (most recent call last)