Report distance on successes only
@@ -705,8 +705,8 @@ class CarliniWagnerL2(object):
_logger.debug(" Successfully generated adversarial examples " +
"on {} of {} instances.".
format(sum(upper_bound < 1e9), batch_size))
- mean = np.mean(np.sqrt(o_bestl2))
- _logger.debug(" Mean distortion: {:.4g}".format(mean))
+ mean = np.mean(np.sqrt(o_bestl2[o_bestl2<1e9]))
+ _logger.debug(" Mean successful distortion: {:.4g}".format(mean))
# return the best solution found
o_bestl2 = np.array(o_bestl2)
