Comply with PEP8 coding style
@@ -789,7 +789,8 @@ def deepfool_attack(sess, x, predictions, logits, grads, sample, nb_candidate,
while (np.any(current == original) and iteration < max_iter):
if iteration % 5 == 0 and iteration > 0:
- _logger.info("Attack result at iteration {} is {}".format(iteration,
+ _logger.info("Attack result at iteration {} is {}".format(
+ iteration,
current))
gradients = sess.run(grads, feed_dict={x: adv_x})
f = sess.run(predictions, feed_dict={x: adv_x})
@@ -818,12 +819,15 @@ def deepfool_attack(sess, x, predictions, logits, grads, sample, nb_candidate,
# need more revision, including info like how many succeed
_logger.info("Attack result at iteration {} is {}".format(iteration,
current))
- _logger.info("{} out of {}".format(sum(current!=original), sample.shape[0])
- + " becomes adversarial examples at iteration {}".format(iteration))
+ _logger.info("{} out of {}".format(sum(current != original),
+ sample.shape[0]) +
+ " becomes adversarial examples at iteration {}".format(
+ iteration))
# need to clip this image into the given range
adv_x = np.clip((1+overshoot)*r_tot + sample, clip_min, clip_max)
return adv_x
+
def gradient_graph(predictions, x, nb_candidate):
"""
Create the gradient graph to be ran later in a TF session
