sess = tf.Session()
with sess.as_default():
aa=tf.sign(grad)
bb=aa.eval(session=sess, feed_dict={x??: x_test?? })
--
You received this message because you are subscribed to the Google Groups "cleverhans dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cleverhans-de...@googlegroups.com.
To post to this group, send email to cleverh...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cleverhans-dev/0fac7a9a-0d7e-4cb4-ac18-b48b797e23ad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
x = tf.placeholder(tf.float32, shape=(None, img_rows, img_cols,
nchannels))
loss = CrossEntropy(model, smoothing=label_smoothing)
# loss=cross_entropy(labels=y, logits=model.get_logits(x)) did not appear to work. CrossEntropy seems to need the primary "model" input parameter.
grad, = tf.gradients(loss, x)
sg = tf.sign(grad)
#
sgv = sg.eval(session=sess, feed_dict={x: x_test})
np.save('pert.npy',sgv)
Excellent. Thank you for your kind and expert help. Once I have established some helpful software scripts, I am looking forward to developing additional adversarial examples through understanding and execution of the attacks in the cleverhans library.Thanks for your patience. ATSent via the Samsung Galaxy S® 4 mini ™, an AT&T 4G LTE smartphone-------- Original message --------From: Ian Goodfellow <goodfel...@gmail.com>Date:11/28/2018 5:39 PM (GMT-05:00)To: "ephi...@yahoo.com" <ephi...@yahoo.com>Cc: cleverhans dev <cleverhans-dev@googlegroups.com>Subject: Re: How do I evaluate tf.sign(grad)?The key in feed_dict should be the TensorFlow representation of the input to the network. The value should be the NumPy representation.You might have something likex = tf.placeholder(...)loss = cross_entropy(labels=y, logits=model.get_logits(x))grad, = tf.gradients(loss, x)sg = tf.sign(grad)with sess.as_default():sgv = sg.eval(feed_dict={x: MNIST.x_test})
On Wed, Nov 28, 2018 at 5:31 PM 'ephi...@yahoo.com' via cleverhans dev <cleverhans-dev@googlegroups.com> wrote:
--In the cleverhans\attacks.py code, the tensor "grad" is the gradient of the loss function w.r.t. "x", where x is a tensor of image data dtype=float32, shape (10000, 32, 32, 3).How do I evaluate tf.sign(grad)? what scalar or numpy array data should I feed it?sess = tf.Session()
with sess.as_default():
aa=tf.sign(grad)
bb=aa.eval(session=sess, feed_dict={x??: x_test?? })
You received this message because you are subscribed to the Google Groups "cleverhans dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cleverhans-dev+unsubscribe@googlegroups.com.
To post to this group, send email to cleverhans-dev@googlegroups.com.
On Wed, Nov 28, 2018 at 5:31 PM 'ephi...@yahoo.com' via cleverhans dev <cleverh...@googlegroups.com> wrote:
--In the cleverhans\attacks.py code, the tensor "grad" is the gradient of the loss function w.r.t. "x", where x is a tensor of image data dtype=float32, shape (10000, 32, 32, 3).How do I evaluate tf.sign(grad)? what scalar or numpy array data should I feed it?sess = tf.Session()
with sess.as_default():
aa=tf.sign(grad)
bb=aa.eval(session=sess, feed_dict={x??: x_test?? })
You received this message because you are subscribed to the Google Groups "cleverhans dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cleverhans-de...@googlegroups.com.
To post to this group, send email to cleverh...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cleverhans-dev/0fac7a9a-0d7e-4cb4-ac18-b48b797e23ad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "cleverhans dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cleverhans-de...@googlegroups.com.
To post to this group, send email to cleverh...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cleverhans-dev/9811d850-8da9-4e2b-963e-5d4773572baf%40googlegroups.com.
x = tf.placeholder(tf.float32, shape=(None, img_rows, img_cols, nchannels))
y = tf.placeholder(tf.float32, shape=(None, nb_classes)) loss = CrossEntropy(model, smoothing=label_smoothing)
losses= loss.fprop(x, y)
grad, = tf.gradients(losses, x)
sg = tf.sign(grad)
x_sample = x_test[: ,:, :, :]
adv_x_sample = adv_x.eval(session=sess, feed_dict={x: x_test})
np.save('legitx.npy',x_sample)
np.save('adv-x-p1.npy',adv_x_sample)
with sess.as_default():
sgv = sg.eval(feed_dict={x: x_test})
np.save('pert-p1.npy',sgv)
You need to call `loss.fprop` to get a TensorFlow Tensor. In the code you have there `loss` is an instance of the CrossEntropy class. It is an object that knows how to build the Tensor you need, but it's not a Tensor itself.
On Wed, Nov 28, 2018 at 5:31 PM 'ephi...@yahoo.com' via cleverhans dev <cleverhans-dev@googlegroups.com> wrote:
--In the cleverhans\attacks.py code, the tensor "grad" is the gradient of the loss function w.r.t. "x", where x is a tensor of image data dtype=float32, shape (10000, 32, 32, 3).How do I evaluate tf.sign(grad)? what scalar or numpy array data should I feed it?sess = tf.Session()
with sess.as_default():
aa=tf.sign(grad)
bb=aa.eval(session=sess, feed_dict={x??: x_test?? })
You received this message because you are subscribed to the Google Groups "cleverhans dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cleverhans-dev+unsubscribe@googlegroups.com.
To post to this group, send email to cleverhans-dev@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cleverhans-dev/0fac7a9a-0d7e-4cb4-ac18-b48b797e23ad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "cleverhans dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cleverhans-dev+unsubscribe@googlegroups.com.
To post to this group, send email to cleverhans-dev@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to cleverhans-de...@googlegroups.com.
To post to this group, send email to cleverh...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cleverhans-dev/0fac7a9a-0d7e-4cb4-ac18-b48b797e23ad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "cleverhans dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cleverhans-de...@googlegroups.com.
To post to this group, send email to cleverh...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cleverhans-dev/9811d850-8da9-4e2b-963e-5d4773572baf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "cleverhans dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cleverhans-de...@googlegroups.com.
To post to this group, send email to cleverh...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cleverhans-dev/0d8689e3-2218-4394-829b-2d7cdb74ab36%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You need to pass *both* placeholders in one dictionary.
To unsubscribe from this group and stop receiving emails from it, send an email to cleverhans-dev+unsubscribe@googlegroups.com.
To post to this group, send email to cleverhans-dev@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cleverhans-dev/0fac7a9a-0d7e-4cb4-ac18-b48b797e23ad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "cleverhans dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cleverhans-dev+unsubscribe@googlegroups.com.
To post to this group, send email to cleverhans-dev@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cleverhans-dev/9811d850-8da9-4e2b-963e-5d4773572baf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "cleverhans dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cleverhans-dev+unsubscribe@googlegroups.com.
To post to this group, send email to cleverhans-dev@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cleverhans-dev/0d8689e3-2218-4394-829b-2d7cdb74ab36%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.