提交 aeba2b3e 编写于 作者: J jin-xiulang

modify input batch_size for defenses tests

上级 151e10e8
...@@ -41,7 +41,7 @@ def test_lenet_mnist_fuzzing(): ...@@ -41,7 +41,7 @@ def test_lenet_mnist_fuzzing():
model = Model(net) model = Model(net)
# get training data # get training data
data_list = "./MNIST_datasets/train" data_list = "./MNIST_unzip/train"
batch_size = 32 batch_size = 32
ds = generate_mnist_dataset(data_list, batch_size, sparse=True) ds = generate_mnist_dataset(data_list, batch_size, sparse=True)
train_images = [] train_images = []
...@@ -55,7 +55,7 @@ def test_lenet_mnist_fuzzing(): ...@@ -55,7 +55,7 @@ def test_lenet_mnist_fuzzing():
# fuzz test with original test data # fuzz test with original test data
# get test data # get test data
data_list = "./MNIST_datasets/test" data_list = "./MNIST_unzip/test"
batch_size = 32 batch_size = 32
ds = generate_mnist_dataset(data_list, batch_size, sparse=True) ds = generate_mnist_dataset(data_list, batch_size, sparse=True)
test_images = [] test_images = []
......
...@@ -39,7 +39,7 @@ TAG = 'Ad_Test' ...@@ -39,7 +39,7 @@ TAG = 'Ad_Test'
def test_ad(): def test_ad():
"""UT for adversarial defense.""" """UT for adversarial defense."""
num_classes = 10 num_classes = 10
batch_size = 16 batch_size = 32
sparse = False sparse = False
context.set_context(mode=context.GRAPH_MODE) context.set_context(mode=context.GRAPH_MODE)
......
...@@ -41,7 +41,7 @@ TAG = 'Ead_Test' ...@@ -41,7 +41,7 @@ TAG = 'Ead_Test'
def test_ead(): def test_ead():
"""UT for ensemble adversarial defense.""" """UT for ensemble adversarial defense."""
num_classes = 10 num_classes = 10
batch_size = 16 batch_size = 64
sparse = False sparse = False
context.set_context(mode=context.GRAPH_MODE) context.set_context(mode=context.GRAPH_MODE)
...@@ -53,7 +53,7 @@ def test_ead(): ...@@ -53,7 +53,7 @@ def test_ead():
if not sparse: if not sparse:
labels = np.eye(num_classes)[labels].astype(np.float32) labels = np.eye(num_classes)[labels].astype(np.float32)
net = SimpleNet() net = Net()
loss_fn = nn.SoftmaxCrossEntropyWithLogits(is_grad=False, sparse=sparse) loss_fn = nn.SoftmaxCrossEntropyWithLogits(is_grad=False, sparse=sparse)
optimizer = Momentum(net.trainable_params(), 0.001, 0.9) optimizer = Momentum(net.trainable_params(), 0.001, 0.9)
......
...@@ -39,7 +39,7 @@ TAG = 'Nad_Test' ...@@ -39,7 +39,7 @@ TAG = 'Nad_Test'
def test_nad(): def test_nad():
"""UT for natural adversarial defense.""" """UT for natural adversarial defense."""
num_classes = 10 num_classes = 10
batch_size = 16 batch_size = 32
sparse = False sparse = False
context.set_context(mode=context.GRAPH_MODE) context.set_context(mode=context.GRAPH_MODE)
......
...@@ -39,7 +39,7 @@ TAG = 'Pad_Test' ...@@ -39,7 +39,7 @@ TAG = 'Pad_Test'
def test_pad(): def test_pad():
"""UT for projected adversarial defense.""" """UT for projected adversarial defense."""
num_classes = 10 num_classes = 10
batch_size = 16 batch_size = 32
sparse = False sparse = False
context.set_context(mode=context.GRAPH_MODE) context.set_context(mode=context.GRAPH_MODE)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册