From aeba2b3e2449b2c5a70b46955853370db82999c7 Mon Sep 17 00:00:00 2001 From: jin-xiulang Date: Thu, 14 May 2020 16:58:11 +0800 Subject: [PATCH] modify input batch_size for defenses tests --- example/mnist_demo/lenet5_mnist_fuzzing.py | 4 ++-- tests/ut/python/defenses/test_ad.py | 2 +- tests/ut/python/defenses/test_ead.py | 4 ++-- tests/ut/python/defenses/test_nad.py | 2 +- tests/ut/python/defenses/test_pad.py | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/example/mnist_demo/lenet5_mnist_fuzzing.py b/example/mnist_demo/lenet5_mnist_fuzzing.py index 4adcbbd..77f7da5 100644 --- a/example/mnist_demo/lenet5_mnist_fuzzing.py +++ b/example/mnist_demo/lenet5_mnist_fuzzing.py @@ -41,7 +41,7 @@ def test_lenet_mnist_fuzzing(): model = Model(net) # get training data - data_list = "./MNIST_datasets/train" + data_list = "./MNIST_unzip/train" batch_size = 32 ds = generate_mnist_dataset(data_list, batch_size, sparse=True) train_images = [] @@ -55,7 +55,7 @@ def test_lenet_mnist_fuzzing(): # fuzz test with original test data # get test data - data_list = "./MNIST_datasets/test" + data_list = "./MNIST_unzip/test" batch_size = 32 ds = generate_mnist_dataset(data_list, batch_size, sparse=True) test_images = [] diff --git a/tests/ut/python/defenses/test_ad.py b/tests/ut/python/defenses/test_ad.py index 78b581a..0a3015f 100644 --- a/tests/ut/python/defenses/test_ad.py +++ b/tests/ut/python/defenses/test_ad.py @@ -39,7 +39,7 @@ TAG = 'Ad_Test' def test_ad(): """UT for adversarial defense.""" num_classes = 10 - batch_size = 16 + batch_size = 32 sparse = False context.set_context(mode=context.GRAPH_MODE) diff --git a/tests/ut/python/defenses/test_ead.py b/tests/ut/python/defenses/test_ead.py index 9eeac21..f44cc41 100644 --- a/tests/ut/python/defenses/test_ead.py +++ b/tests/ut/python/defenses/test_ead.py @@ -41,7 +41,7 @@ TAG = 'Ead_Test' def test_ead(): """UT for ensemble adversarial defense.""" num_classes = 10 - batch_size = 16 + batch_size = 64 sparse = False context.set_context(mode=context.GRAPH_MODE) @@ -53,7 +53,7 @@ def test_ead(): if not sparse: labels = np.eye(num_classes)[labels].astype(np.float32) - net = SimpleNet() + net = Net() loss_fn = nn.SoftmaxCrossEntropyWithLogits(is_grad=False, sparse=sparse) optimizer = Momentum(net.trainable_params(), 0.001, 0.9) diff --git a/tests/ut/python/defenses/test_nad.py b/tests/ut/python/defenses/test_nad.py index 938a4e5..f0d8981 100644 --- a/tests/ut/python/defenses/test_nad.py +++ b/tests/ut/python/defenses/test_nad.py @@ -39,7 +39,7 @@ TAG = 'Nad_Test' def test_nad(): """UT for natural adversarial defense.""" num_classes = 10 - batch_size = 16 + batch_size = 32 sparse = False context.set_context(mode=context.GRAPH_MODE) diff --git a/tests/ut/python/defenses/test_pad.py b/tests/ut/python/defenses/test_pad.py index 7908095..e92d7ce 100644 --- a/tests/ut/python/defenses/test_pad.py +++ b/tests/ut/python/defenses/test_pad.py @@ -39,7 +39,7 @@ TAG = 'Pad_Test' def test_pad(): """UT for projected adversarial defense.""" num_classes = 10 - batch_size = 16 + batch_size = 32 sparse = False context.set_context(mode=context.GRAPH_MODE) -- GitLab