Clean up JSMA tutorial figure code
@@ -119,6 +119,7 @@ def mnist_tutorial_jsma(train_start=0, train_end=60000, test_start=0,
'clip_max': 1., 'targets': y,
'y_val': None}
+ figure = None
# Loop over the samples we want to perturb into adversarial examples
for sample_ind in xrange(0, source_samples):
print('--------------------------------------')
@@ -155,11 +156,6 @@ def mnist_tutorial_jsma(train_start=0, train_end=60000, test_start=0,
# Display the original and adversarial images side-by-side
if viz_enabled:
- if 'figure' not in vars():
- figure = pair_visual(
- np.reshape(sample, (img_rows, img_cols)),
- np.reshape(adv_x, (img_rows, img_cols)))
- else:
figure = pair_visual(
np.reshape(sample, (img_rows, img_cols)),
np.reshape(adv_x, (img_rows, img_cols)), figure)
