7baa06c0a69e4e5d62483dd46690ac911b54c475,art/attacks/fast_gradient_unittest.py,TestFastGradientMethod,_test_mnist_targeted,#TestFastGradientMethod#Any#,252
Before Change
// Test FGSM with np.inf norm
attack = FastGradientMethod(classifier, eps=1.0, targeted=True)
//y_train_adv = to_categorical((np.argmax(y_train, axis=1) + 1) % 10, 10)
y_test_adv = to_categorical((np.argmax(y_test, axis=1) + 1) % 10, 10)
x_test_adv = attack.generate(x_test, minimal=True, eps_step=0.01, eps=1.0, y=y_test_adv)
// x_train_adv = attack.generate(x_train, minimal=True, eps_step=0.01, y=y_train_adv)
After Change
//y_train_adv = to_categorical((np.argmax(y_train, axis=1) + 1) % 10, 10)
pred_sort = classifier.predict(x_test).argsort(axis=1)
y_test_adv = np.zeros((x_test.shape[0],10))
for i in range(x_test.shape[0]):
y_test_adv[i,pred_sort[i,-2]] = 1.0
//y_test_adv = to_categorical((np.argmax(y_test, axis=1) + 1) % 10, 10)
x_test_adv = attack.generate(x_test, minimal=True, eps_step=0.01, eps=1.0, y=y_test_adv)
// x_train_adv = attack.generate(x_train, minimal=True, eps_step=0.01, y=y_train_adv)
// self.assertFalse((x_train == x_train_adv).all())
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 7
Instances
Project Name: IBM/adversarial-robustness-toolbox
Commit Name: 7baa06c0a69e4e5d62483dd46690ac911b54c475
Time: 2018-08-24
Author: BJEdwards@gmail.com
File Name: art/attacks/fast_gradient_unittest.py
Class Name: TestFastGradientMethod
Method Name: _test_mnist_targeted
Project Name: pytorch/fairseq
Commit Name: f305086031fc31a838d5b6c06eec35fd5cd16038
Time: 2019-03-19
Author: myleott@fb.com
File Name: scripts/score_moe.py
Class Name:
Method Name: intra_ref
Project Name: IBM/adversarial-robustness-toolbox
Commit Name: 7baa06c0a69e4e5d62483dd46690ac911b54c475
Time: 2018-08-24
Author: BJEdwards@gmail.com
File Name: art/attacks/iterative_method_unittest.py
Class Name: TestIterativeAttack
Method Name: _test_mnist_targeted