提交 a4cf2954 编写于 作者: D dzhwinter

fix default value. test=develop

上级 a922a0a1
...@@ -49,6 +49,8 @@ class BuildIrMemOptBase(unittest.TestCase): ...@@ -49,6 +49,8 @@ class BuildIrMemOptBase(unittest.TestCase):
'Skip use_parallel_executor=True because Paddle comes without parallel support on windows' 'Skip use_parallel_executor=True because Paddle comes without parallel support on windows'
) )
return return
fluid.default_startup_program().random_seed = 100
fluid.default_main_program().random_seed = 100
batch_size = 32 batch_size = 32
batch_size *= fluid.core.get_cuda_device_count() if use_cuda else int( batch_size *= fluid.core.get_cuda_device_count() if use_cuda else int(
os.environ.get('CPU_NUM', multiprocessing.cpu_count())) os.environ.get('CPU_NUM', multiprocessing.cpu_count()))
...@@ -74,8 +76,6 @@ class BuildIrMemOptBase(unittest.TestCase): ...@@ -74,8 +76,6 @@ class BuildIrMemOptBase(unittest.TestCase):
feeder = fluid.DataFeeder(feed_list=[data, label], place=place) feeder = fluid.DataFeeder(feed_list=[data, label], place=place)
reader = feeder.decorate_reader(train_reader, multi_devices=True) reader = feeder.decorate_reader(train_reader, multi_devices=True)
exe = fluid.Executor(place) exe = fluid.Executor(place)
fluid.default_startup_program().random_seed = 100
fluid.default_main_program().random_seed = 100
exe.run(fluid.default_startup_program()) exe.run(fluid.default_startup_program())
train_cp = compiler.CompiledProgram(fluid.default_main_program()) train_cp = compiler.CompiledProgram(fluid.default_main_program())
...@@ -139,7 +139,7 @@ class TestIrMemOptBase(BuildIrMemOptBase): ...@@ -139,7 +139,7 @@ class TestIrMemOptBase(BuildIrMemOptBase):
self.network, self.network,
use_cuda=use_cuda, use_cuda=use_cuda,
memory_opt=use_python_mem_opt) memory_opt=use_python_mem_opt)
self.assertAlmostEquals(baseline_last_loss, self.assertAlmostEquals(np.mean(baseline_last_loss),
cur_last_loss, 1e-2) np.mean(cur_last_loss), delta=1e-2)
self.assertAlmostEquals(baseline_first_loss, self.assertAlmostEquals(np.mean(baseline_first_loss),
cur_first_loss, 1e-2) np.mean(cur_first_loss), delta=1e-2)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册