Generate adversarial samples and return them in a Numpy array.
if self.back == "th":
raise NotImplementedError("Theano version not implemented.")
// Verify label placeholder was defined previously if using true labels
if params["Y"] is not None and self.y is None:
error = "True labels given but label placeholder missing in _init_"
raise Exception(error)
import tensorflow as tf
// Generate this attack"s graph if it hasn"t been done previously
if not hasattr(self, "_x"):
input_shape = list(X.shape)
input_shape[0] = None
self._x = tf.placeholder(tf.float32, shape=input_shape)
self._x_adv = self.generate(self._x)
// Run symbolic graph without or with true labels
if params["Y"] is None:
feed_dict = {self._x: X}
else:
feed_dict = {self._x: X, self.y: params["Y"]}
return self.sess.run(self._x_adv, feed_dict=feed_dict)
class BasicIterativeMethod(Attack):