c8a9b2b2f14226567f2e1b42e7cf007b38c0fba3,tests/classifiers/test_pytorch.py,TestPyTorchClassifier,test_class_gradient_target,#TestPyTorchClassifier#,167
Before Change
grads = ptc.class_gradient(x_test, label=3)
self.assertTrue(np.array(grads.shape == (NB_TEST, 1, 1, 28, 28)).all())
self.assertNotEqual(np.sum(grads), 0)
def test_loss_gradient(self):
// Get MNIST
(_, _), (x_test, y_test) = self.mnist
After Change
np.testing.assert_array_almost_equal(gradients[0, 0, 0, 14, :], expected_gradients_2, decimal=4)
def test_class_gradient_target(self):
classifier = get_classifier_pt()
gradients = classifier.class_gradient(self.x_test, label=3)
self.assertEqual(gradients.shape, (NB_TEST, 1, 1, 28, 28))
In pattern: SUPERPATTERN
Frequency: 6
Non-data size: 3
Instances
Project Name: IBM/adversarial-robustness-toolbox
Commit Name: c8a9b2b2f14226567f2e1b42e7cf007b38c0fba3
Time: 2019-08-19
Author: beat.buesser@ie.ibm.com
File Name: tests/classifiers/test_pytorch.py
Class Name: TestPyTorchClassifier
Method Name: test_class_gradient_target
Project Name: IBM/adversarial-robustness-toolbox
Commit Name: c8a9b2b2f14226567f2e1b42e7cf007b38c0fba3
Time: 2019-08-19
Author: beat.buesser@ie.ibm.com
File Name: tests/classifiers/test_pytorch.py
Class Name: TestPyTorchClassifier
Method Name: test_fit_generator
Project Name: IBM/adversarial-robustness-toolbox
Commit Name: c8a9b2b2f14226567f2e1b42e7cf007b38c0fba3
Time: 2019-08-19
Author: beat.buesser@ie.ibm.com
File Name: tests/classifiers/test_pytorch.py
Class Name: TestPyTorchClassifier
Method Name: test_loss_gradient
Project Name: IBM/adversarial-robustness-toolbox
Commit Name: c8a9b2b2f14226567f2e1b42e7cf007b38c0fba3
Time: 2019-08-19
Author: beat.buesser@ie.ibm.com
File Name: tests/classifiers/test_pytorch.py
Class Name: TestPyTorchClassifier
Method Name: test_input_shape
Project Name: IBM/adversarial-robustness-toolbox
Commit Name: c8a9b2b2f14226567f2e1b42e7cf007b38c0fba3
Time: 2019-08-19
Author: beat.buesser@ie.ibm.com
File Name: tests/classifiers/test_pytorch.py
Class Name: TestPyTorchClassifier
Method Name: test_class_gradient
Project Name: IBM/adversarial-robustness-toolbox
Commit Name: c8a9b2b2f14226567f2e1b42e7cf007b38c0fba3
Time: 2019-08-19
Author: beat.buesser@ie.ibm.com
File Name: tests/classifiers/test_pytorch.py
Class Name: TestPyTorchClassifier
Method Name: test_fit_predict