未验证 提交 b6715386 编写于 作者: Z Zhen Wang 提交者: GitHub

* Reduce the training iterations in test_fetch_unmerged and test_fuse_bn_act_pass. (#27234)

* Use the single GPU card to execute the test_fuse_bn_act_pass UT.
上级 ece74c4c
...@@ -559,7 +559,7 @@ endif() ...@@ -559,7 +559,7 @@ endif()
set_tests_properties(test_parallel_executor_test_while_train test_parallel_executor_mnist set_tests_properties(test_parallel_executor_test_while_train test_parallel_executor_mnist
test_parallel_executor_feed_persistable_var test_parallel_executor_feed_persistable_var
test_buffer_shared_memory_reuse_pass_and_fuse_optimization_op_pass test_buffer_shared_memory_reuse_pass_and_fuse_optimization_op_pass
test_data_norm_op test_imperative_using_non_zero_gpu test_fuse_bn_act_pass test_data_norm_op test_imperative_using_non_zero_gpu
test_dataloader_keep_order test_dataloader_keep_order
test_dataloader_unkeep_order test_dataloader_unkeep_order
test_parallel_executor_fetch_isolated_var test_parallel_executor_fetch_isolated_var
......
...@@ -28,7 +28,7 @@ class TestFetchUnmerged(unittest.TestCase): ...@@ -28,7 +28,7 @@ class TestFetchUnmerged(unittest.TestCase):
conv_pool_1 = fluid.nets.simple_img_conv_pool( conv_pool_1 = fluid.nets.simple_img_conv_pool(
input=img, input=img,
filter_size=5, filter_size=5,
num_filters=20, num_filters=8,
pool_size=2, pool_size=2,
pool_stride=2, pool_stride=2,
pool_type='max', pool_type='max',
...@@ -37,12 +37,12 @@ class TestFetchUnmerged(unittest.TestCase): ...@@ -37,12 +37,12 @@ class TestFetchUnmerged(unittest.TestCase):
conv_pool_2 = fluid.nets.simple_img_conv_pool( conv_pool_2 = fluid.nets.simple_img_conv_pool(
input=conv_pool_1, input=conv_pool_1,
filter_size=5, filter_size=5,
num_filters=50, num_filters=16,
pool_size=2, pool_size=2,
pool_stride=2, pool_stride=2,
pool_type='avg', pool_type='avg',
act="relu") act="relu")
hidden = fluid.layers.fc(input=conv_pool_2, size=100, act='relu') hidden = fluid.layers.fc(input=conv_pool_2, size=32, act='relu')
prediction = fluid.layers.fc(input=hidden, size=10, act='softmax') prediction = fluid.layers.fc(input=hidden, size=10, act='softmax')
loss = fluid.layers.cross_entropy(input=prediction, label=label) loss = fluid.layers.cross_entropy(input=prediction, label=label)
avg_loss = fluid.layers.mean(loss) avg_loss = fluid.layers.mean(loss)
...@@ -75,8 +75,8 @@ class TestFetchUnmerged(unittest.TestCase): ...@@ -75,8 +75,8 @@ class TestFetchUnmerged(unittest.TestCase):
binary = fluid.CompiledProgram(main_program).with_data_parallel( binary = fluid.CompiledProgram(main_program).with_data_parallel(
loss_name=loss.name, build_strategy=build_strategy) loss_name=loss.name, build_strategy=build_strategy)
iters = 3 iters = 2
batch_size = 64 batch_size = 16
train_reader = paddle.batch( train_reader = paddle.batch(
paddle.reader.shuffle( paddle.reader.shuffle(
paddle.dataset.mnist.train(), buf_size=500), paddle.dataset.mnist.train(), buf_size=500),
......
...@@ -25,7 +25,7 @@ class TestFuseBatchNormActPass(unittest.TestCase): ...@@ -25,7 +25,7 @@ class TestFuseBatchNormActPass(unittest.TestCase):
hidden1 = fluid.layers.conv2d( hidden1 = fluid.layers.conv2d(
input=x, input=x,
filter_size=3, filter_size=3,
num_filters=32, num_filters=16,
stride=1, stride=1,
padding=1, padding=1,
act=None, act=None,
...@@ -43,7 +43,7 @@ class TestFuseBatchNormActPass(unittest.TestCase): ...@@ -43,7 +43,7 @@ class TestFuseBatchNormActPass(unittest.TestCase):
bias_attr=bias_attr, bias_attr=bias_attr,
act='relu', act='relu',
data_layout='NHWC') data_layout='NHWC')
hidden3 = fluid.layers.fc(input=hidden2, size=128, act='relu') hidden3 = fluid.layers.fc(input=hidden2, size=32, act='relu')
hidden4 = fluid.layers.batch_norm( hidden4 = fluid.layers.batch_norm(
input=hidden3, act='relu', data_layout='NHWC') input=hidden3, act='relu', data_layout='NHWC')
prediction = fluid.layers.fc(input=hidden4, size=10, act='softmax') prediction = fluid.layers.fc(input=hidden4, size=10, act='softmax')
...@@ -63,7 +63,7 @@ class TestFuseBatchNormActPass(unittest.TestCase): ...@@ -63,7 +63,7 @@ class TestFuseBatchNormActPass(unittest.TestCase):
startup_program = fluid.Program() startup_program = fluid.Program()
x, y, loss = self.build_program(main_program, startup_program, use_cuda) x, y, loss = self.build_program(main_program, startup_program, use_cuda)
exe = fluid.Executor(place) exe = fluid.Executor(place)
iters = 10 iters = 8
batch_size = 16 batch_size = 16
feeder = fluid.DataFeeder(feed_list=[x, y], place=place) feeder = fluid.DataFeeder(feed_list=[x, y], place=place)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册