提交 b7ef2e0b 编写于 作者: M mindspore-ci-bot 提交者: Gitee

!18 Modify the inputs batch_size of defense tests to adapt to current version MindSpore.

Merge pull request !18 from jxlang910/master
......@@ -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 = []
......
......@@ -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)
......
......@@ -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)
......
......@@ -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)
......
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册