for classifier in image_classifier_list:
// TODO this if statement must be removed once we have a classifier for both image and tabular data
if classifier is None:
logging.warning("Couldn"t perform this test because no classifier is defined")
return
attack = FastGradientMethod(classifier, eps=1, norm=2, batch_size=128)
x_test_adv = attack.generate(x_test_mnist)
utils_test.assert_almost_equal_mean(x_test_mnist, x_test_adv, 0.007636424, decimal=0.002)
After Change
return
for classifier in image_classifier_list:
if FastGradientMethod.is_valid_classifier_type(classifier) is False:
continue
attack = FastGradientMethod(classifier, eps=1, norm=2, batch_size=128)
x_test_adv = attack.generate(x_test_mnist)
utils_test.assert_almost_equal_mean(x_test_mnist, x_test_adv, 0.007636424, decimal=0.002)