Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No gradient provided for any variable error #4

Open
maithal opened this issue Oct 20, 2020 · 0 comments
Open

No gradient provided for any variable error #4

maithal opened this issue Oct 20, 2020 · 0 comments

Comments

@maithal
Copy link

maithal commented Oct 20, 2020

Hi,

I am trying to run this attack method but I am facing an issue in training the mnist model. I am constantly getting the ValueError stating the Adam optimizer isn't receiving any gradient. Please find the error below:

Traceback (most recent call last):
File "/home/Documents/Query-based-blackbox-attack/my_train.py", line 59, in
main(args.model, args.type)
File "/home/Documents/Query-based-blackbox-attack/my_train.py", line 36, in main
tf_train(x, y, model, X_train, Y_train, data_gen, None, None)
File "/home/Documents/Query-based-blackbox-attack/tf_utils.py", line 86, in tf_train
optimizer = tf.train.AdamOptimizer().minimize(loss)
File "/home/Desktop/my_project/venv/lib/python3.6/site-packages/tensorflow/python/training/optimizer.py", line 421, in minimize
([str(v) for _, v in grads_and_vars], loss))
ValueError: No gradients provided for any variable, check your graph for ops that do not support gradients, between variables ["<tf.Variable 'convolution2d_1_W:0' shape=(8, 8, 1, 64) dtype=float32_ref>", "<tf.Variable 'convolution2d_1_b:0' shape=(64,) dtype=float32_ref>", "<tf.Variable 'convolution2d_2_W:0' shape=(6, 6, 64, 128) dtype=float32_ref>", "<tf.Variable 'convolution2d_2_b:0' shape=(128,) dtype=float32_ref>", "<tf.Variable 'convolution2d_3_W:0' shape=(5, 5, 128, 128) dtype=float32_ref>", "<tf.Variable 'convolution2d_3_b:0' shape=(128,) dtype=float32_ref>", "<tf.Variable 'dense_1_W:0' shape=(128, 10) dtype=float32_ref>", "<tf.Variable 'dense_1_b:0' shape=(10,) dtype=float32_ref>"] and loss Tensor("Mean:0", shape=(), dtype=float32, device=/device:GPU:0).

Please help me with this error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant