From eb45bb4ec5ab12c59e9080b87659f230486013b6 Mon Sep 17 00:00:00 2001 From: yaozhixin <522190855@qq.com> Date: Wed, 26 Jan 2022 15:14:06 +0800 Subject: [PATCH] update uts p3 (#39214) --- .../fluid/tests/unittests/ipu/test_pool_max_op_ipu.py | 4 ++-- .../fluid/tests/unittests/ipu/test_pow_op_ipu.py | 8 ++++---- .../fluid/tests/unittests/ipu/test_reduce_x_op_ipu.py | 4 ++-- .../tests/unittests/ipu/test_reshape_inplace_op_ipu.py | 4 ++-- .../fluid/tests/unittests/ipu/test_reshape_op_ipu.py | 4 ++-- .../paddle/fluid/tests/unittests/ipu/test_save_load.py | 5 +++-- .../fluid/tests/unittests/ipu/test_scale_op_ipu.py | 8 ++++---- .../tests/unittests/ipu/test_set_batch_size_ipu.py | 7 +++---- .../fluid/tests/unittests/ipu/test_sgd_optimizer.py | 4 ++-- .../fluid/tests/unittests/ipu/test_slice_op_ipu.py | 8 ++++---- .../fluid/tests/unittests/ipu/test_softmax_op_ipu.py | 4 ++-- .../fluid/tests/unittests/ipu/test_squeeze_op_ipu.py | 6 +++--- .../fluid/tests/unittests/ipu/test_stack_op_ipu.py | 4 ++-- .../fluid/tests/unittests/ipu/test_sum_op_ipu.py | 10 +++++----- .../fluid/tests/unittests/ipu/test_topk_op_ipu.py | 4 ++-- .../fluid/tests/unittests/ipu/test_transpose_op_ipu.py | 4 ++-- .../fluid/tests/unittests/ipu/test_unsqueeze_op_ipu.py | 4 ++-- .../fluid/tests/unittests/ipu/test_varname_inplace.py | 4 ++-- 18 files changed, 48 insertions(+), 48 deletions(-) diff --git a/python/paddle/fluid/tests/unittests/ipu/test_pool_max_op_ipu.py b/python/paddle/fluid/tests/unittests/ipu/test_pool_max_op_ipu.py index fffac12185..a7c45c6686 100644 --- a/python/paddle/fluid/tests/unittests/ipu/test_pool_max_op_ipu.py +++ b/python/paddle/fluid/tests/unittests/ipu/test_pool_max_op_ipu.py @@ -87,8 +87,8 @@ class TestBase(IPUOpTest): if run_ipu: feed_list = self.feed_list - ipu_strategy = compiler.get_ipu_strategy() - ipu_strategy.is_training = self.is_training + ipu_strategy = paddle.static.IpuStrategy() + ipu_strategy.SetGraphConfig(is_training=self.is_training) program = compiler.IPUCompiledProgram( main_prog, ipu_strategy=ipu_strategy).compile(feed_list, fetch_list) diff --git a/python/paddle/fluid/tests/unittests/ipu/test_pow_op_ipu.py b/python/paddle/fluid/tests/unittests/ipu/test_pow_op_ipu.py index 8ede44d7f9..5059de7ba7 100644 --- a/python/paddle/fluid/tests/unittests/ipu/test_pow_op_ipu.py +++ b/python/paddle/fluid/tests/unittests/ipu/test_pow_op_ipu.py @@ -78,8 +78,8 @@ class TestBase(IPUOpTest): if run_ipu: feed_list = self.feed_list - ipu_strategy = compiler.get_ipu_strategy() - ipu_strategy.is_training = self.is_training + ipu_strategy = paddle.static.IpuStrategy() + ipu_strategy.SetGraphConfig(is_training=self.is_training) program = compiler.IPUCompiledProgram( main_prog, ipu_strategy=ipu_strategy).compile(feed_list, fetch_list) @@ -141,8 +141,8 @@ class TestCase1(TestBase): if run_ipu: feed_list = self.feed_list - ipu_strategy = compiler.get_ipu_strategy() - ipu_strategy.is_training = self.is_training + ipu_strategy = paddle.static.IpuStrategy() + ipu_strategy.SetGraphConfig(is_training=self.is_training) program = compiler.IPUCompiledProgram( main_prog, ipu_strategy=ipu_strategy).compile(feed_list, fetch_list) diff --git a/python/paddle/fluid/tests/unittests/ipu/test_reduce_x_op_ipu.py b/python/paddle/fluid/tests/unittests/ipu/test_reduce_x_op_ipu.py index f8c96684af..ac8ad08e8b 100644 --- a/python/paddle/fluid/tests/unittests/ipu/test_reduce_x_op_ipu.py +++ b/python/paddle/fluid/tests/unittests/ipu/test_reduce_x_op_ipu.py @@ -71,8 +71,8 @@ class TestMean(IPUOpTest): if run_ipu: feed_list = self.feed_list - ipu_strategy = compiler.get_ipu_strategy() - ipu_strategy.is_training = self.is_training + ipu_strategy = paddle.static.IpuStrategy() + ipu_strategy.SetGraphConfig(is_training=self.is_training) program = compiler.IPUCompiledProgram( main_prog, ipu_strategy=ipu_strategy).compile(feed_list, fetch_list) diff --git a/python/paddle/fluid/tests/unittests/ipu/test_reshape_inplace_op_ipu.py b/python/paddle/fluid/tests/unittests/ipu/test_reshape_inplace_op_ipu.py index a6e0552691..f312b7b69a 100644 --- a/python/paddle/fluid/tests/unittests/ipu/test_reshape_inplace_op_ipu.py +++ b/python/paddle/fluid/tests/unittests/ipu/test_reshape_inplace_op_ipu.py @@ -82,8 +82,8 @@ class TestBase(IPUOpTest): if run_ipu: feed_list = self.feed_list - ipu_strategy = compiler.get_ipu_strategy() - ipu_strategy.is_training = self.is_training + ipu_strategy = paddle.static.IpuStrategy() + ipu_strategy.SetGraphConfig(is_training=self.is_training) program = compiler.IPUCompiledProgram( main_prog, ipu_strategy=ipu_strategy).compile(feed_list, fetch_list) diff --git a/python/paddle/fluid/tests/unittests/ipu/test_reshape_op_ipu.py b/python/paddle/fluid/tests/unittests/ipu/test_reshape_op_ipu.py index 2cc0d1770b..5163838bc0 100644 --- a/python/paddle/fluid/tests/unittests/ipu/test_reshape_op_ipu.py +++ b/python/paddle/fluid/tests/unittests/ipu/test_reshape_op_ipu.py @@ -76,8 +76,8 @@ class TestBase(IPUOpTest): if run_ipu: feed_list = self.feed_list - ipu_strategy = compiler.get_ipu_strategy() - ipu_strategy.is_training = self.is_training + ipu_strategy = paddle.static.IpuStrategy() + ipu_strategy.SetGraphConfig(is_training=self.is_training) program = compiler.IPUCompiledProgram( main_prog, ipu_strategy=ipu_strategy).compile(feed_list, fetch_list) diff --git a/python/paddle/fluid/tests/unittests/ipu/test_save_load.py b/python/paddle/fluid/tests/unittests/ipu/test_save_load.py index 5d9ff4eb88..24bb8e1118 100644 --- a/python/paddle/fluid/tests/unittests/ipu/test_save_load.py +++ b/python/paddle/fluid/tests/unittests/ipu/test_save_load.py @@ -93,8 +93,9 @@ class TestBase(IPUOpTest): if not save_otherwise_load: paddle.static.load(main_prog, "model/model") - ipu_strategy = compiler.get_ipu_strategy() - ipu_strategy.is_training = self.attrs['is_training'] + ipu_strategy = paddle.static.IpuStrategy() + ipu_strategy.SetGraphConfig( + is_training=self.attrs['is_training']) program = compiler.IPUCompiledProgram( main_prog, ipu_strategy=ipu_strategy).compile( self.feed_list, fetch_list) diff --git a/python/paddle/fluid/tests/unittests/ipu/test_scale_op_ipu.py b/python/paddle/fluid/tests/unittests/ipu/test_scale_op_ipu.py index 94758155b3..6ad2a89a73 100644 --- a/python/paddle/fluid/tests/unittests/ipu/test_scale_op_ipu.py +++ b/python/paddle/fluid/tests/unittests/ipu/test_scale_op_ipu.py @@ -82,8 +82,8 @@ class TestBase(IPUOpTest): if run_ipu: feed_list = self.feed_list - ipu_strategy = compiler.get_ipu_strategy() - ipu_strategy.is_training = self.is_training + ipu_strategy = paddle.static.IpuStrategy() + ipu_strategy.SetGraphConfig(is_training=self.is_training) program = compiler.IPUCompiledProgram( main_prog, ipu_strategy=ipu_strategy).compile(feed_list, fetch_list) @@ -175,8 +175,8 @@ class TestCase4(TestBase): if run_ipu: feed_list = self.feed_list - ipu_strategy = compiler.get_ipu_strategy() - ipu_strategy.is_training = self.is_training + ipu_strategy = paddle.static.IpuStrategy() + ipu_strategy.SetGraphConfig(is_training=self.is_training) program = compiler.IPUCompiledProgram( main_prog, ipu_strategy=ipu_strategy).compile(feed_list, fetch_list) diff --git a/python/paddle/fluid/tests/unittests/ipu/test_set_batch_size_ipu.py b/python/paddle/fluid/tests/unittests/ipu/test_set_batch_size_ipu.py index 335e90b460..93945b98ef 100644 --- a/python/paddle/fluid/tests/unittests/ipu/test_set_batch_size_ipu.py +++ b/python/paddle/fluid/tests/unittests/ipu/test_set_batch_size_ipu.py @@ -81,10 +81,9 @@ class TestBase(IPUOpTest): if run_ipu: feed_list = self.feed_list - ipu_strategy = compiler.get_ipu_strategy() - ipu_strategy.is_training = self.is_training - # set batch size - ipu_strategy.batch_size = 2 + ipu_strategy = paddle.static.IpuStrategy() + ipu_strategy.SetGraphConfig( + batch_size=2, is_training=self.is_training) program = compiler.IPUCompiledProgram( main_prog, ipu_strategy=ipu_strategy).compile(feed_list, fetch_list) diff --git a/python/paddle/fluid/tests/unittests/ipu/test_sgd_optimizer.py b/python/paddle/fluid/tests/unittests/ipu/test_sgd_optimizer.py index ee469c5fc1..df0e2a040b 100644 --- a/python/paddle/fluid/tests/unittests/ipu/test_sgd_optimizer.py +++ b/python/paddle/fluid/tests/unittests/ipu/test_sgd_optimizer.py @@ -59,8 +59,8 @@ class TestSGD(unittest.TestCase): if run_ipu: feed_list = [image.name] fetch_list = [loss.name] - ipu_strategy = compiler.get_ipu_strategy() - ipu_strategy.is_training = True + ipu_strategy = paddle.static.IpuStrategy() + ipu_strategy.SetGraphConfig(is_training=True) program = compiler.IPUCompiledProgram( main_prog, ipu_strategy=ipu_strategy).compile(feed_list, fetch_list) diff --git a/python/paddle/fluid/tests/unittests/ipu/test_slice_op_ipu.py b/python/paddle/fluid/tests/unittests/ipu/test_slice_op_ipu.py index 7261f26c0e..3bdfeabce6 100644 --- a/python/paddle/fluid/tests/unittests/ipu/test_slice_op_ipu.py +++ b/python/paddle/fluid/tests/unittests/ipu/test_slice_op_ipu.py @@ -80,8 +80,8 @@ class TestBase(IPUOpTest): if run_ipu: feed_list = self.feed_list - ipu_strategy = compiler.get_ipu_strategy() - ipu_strategy.is_training = self.is_training + ipu_strategy = paddle.static.IpuStrategy() + ipu_strategy.SetGraphConfig(is_training=self.is_training) program = compiler.IPUCompiledProgram( main_prog, ipu_strategy=ipu_strategy).compile(feed_list, fetch_list) @@ -159,8 +159,8 @@ class TestCase2(TestBase): if run_ipu: feed_list = self.feed_list - ipu_strategy = compiler.get_ipu_strategy() - ipu_strategy.is_training = self.is_training + ipu_strategy = paddle.static.IpuStrategy() + ipu_strategy.SetGraphConfig(is_training=self.is_training) program = compiler.IPUCompiledProgram( main_prog, ipu_strategy=ipu_strategy).compile(feed_list, fetch_list) diff --git a/python/paddle/fluid/tests/unittests/ipu/test_softmax_op_ipu.py b/python/paddle/fluid/tests/unittests/ipu/test_softmax_op_ipu.py index 36cb529c23..a4a4b83baf 100644 --- a/python/paddle/fluid/tests/unittests/ipu/test_softmax_op_ipu.py +++ b/python/paddle/fluid/tests/unittests/ipu/test_softmax_op_ipu.py @@ -77,8 +77,8 @@ class TestBase(IPUOpTest): if run_ipu: feed_list = self.feed_list - ipu_strategy = compiler.get_ipu_strategy() - ipu_strategy.is_training = self.is_training + ipu_strategy = paddle.static.IpuStrategy() + ipu_strategy.SetGraphConfig(is_training=self.is_training) program = compiler.IPUCompiledProgram( main_prog, ipu_strategy=ipu_strategy).compile(feed_list, fetch_list) diff --git a/python/paddle/fluid/tests/unittests/ipu/test_squeeze_op_ipu.py b/python/paddle/fluid/tests/unittests/ipu/test_squeeze_op_ipu.py index 672e6ede0e..ccd2796590 100644 --- a/python/paddle/fluid/tests/unittests/ipu/test_squeeze_op_ipu.py +++ b/python/paddle/fluid/tests/unittests/ipu/test_squeeze_op_ipu.py @@ -77,11 +77,11 @@ class TestBase(IPUOpTest): if run_ipu: feed_list = self.feed_list - ipu_strategy = compiler.get_ipu_strategy() - ipu_strategy.is_training = self.is_training + ipu_strategy = paddle.static.IpuStrategy() + ipu_strategy.SetGraphConfig(is_training=self.is_training) program = compiler.IPUCompiledProgram( main_prog, - ipu_strategy=ipu_strategy).compile(feed_list, fetch_list) + iipu_strategy=ipu_strategy).compile(feed_list, fetch_list) else: program = main_prog diff --git a/python/paddle/fluid/tests/unittests/ipu/test_stack_op_ipu.py b/python/paddle/fluid/tests/unittests/ipu/test_stack_op_ipu.py index 360e81f286..3d5de11b5e 100644 --- a/python/paddle/fluid/tests/unittests/ipu/test_stack_op_ipu.py +++ b/python/paddle/fluid/tests/unittests/ipu/test_stack_op_ipu.py @@ -88,8 +88,8 @@ class TestBase(IPUOpTest): if run_ipu: feed_list = self.feed_list - ipu_strategy = compiler.get_ipu_strategy() - ipu_strategy.is_training = self.is_training + ipu_strategy = paddle.static.IpuStrategy() + ipu_strategy.SetGraphConfig(is_training=self.is_training) program = compiler.IPUCompiledProgram( main_prog, ipu_strategy=ipu_strategy).compile(feed_list, fetch_list) diff --git a/python/paddle/fluid/tests/unittests/ipu/test_sum_op_ipu.py b/python/paddle/fluid/tests/unittests/ipu/test_sum_op_ipu.py index 6bba02942a..003350cd7a 100644 --- a/python/paddle/fluid/tests/unittests/ipu/test_sum_op_ipu.py +++ b/python/paddle/fluid/tests/unittests/ipu/test_sum_op_ipu.py @@ -83,8 +83,8 @@ class TestBase(IPUOpTest): if run_ipu: feed_list = self.feed_list - ipu_strategy = compiler.get_ipu_strategy() - ipu_strategy.is_training = self.is_training + ipu_strategy = paddle.static.IpuStrategy() + ipu_strategy.SetGraphConfig(is_training=self.is_training) program = compiler.IPUCompiledProgram( main_prog, ipu_strategy=ipu_strategy).compile(feed_list, fetch_list) @@ -149,11 +149,11 @@ class TestCase1(TestBase): if run_ipu: feed_list = self.feed_list - ipu_strategy = compiler.get_ipu_strategy() - ipu_strategy.is_training = self.is_training + ipu_strategy = paddle.static.IpuStrategy() + ipu_strategy.SetGraphConfig(is_training=self.is_training) program = compiler.IPUCompiledProgram( main_prog, - ipu_strategy=ipu_strategy).compile(feed_list, fetch_list) + iipu_strategy=ipu_strategy).compile(feed_list, fetch_list) else: program = main_prog diff --git a/python/paddle/fluid/tests/unittests/ipu/test_topk_op_ipu.py b/python/paddle/fluid/tests/unittests/ipu/test_topk_op_ipu.py index 4cbbc9e478..9915a7a1fd 100644 --- a/python/paddle/fluid/tests/unittests/ipu/test_topk_op_ipu.py +++ b/python/paddle/fluid/tests/unittests/ipu/test_topk_op_ipu.py @@ -102,8 +102,8 @@ class TestTopKOp(IPUOpTest): if run_ipu: feed_list = self.feed_list - ipu_strategy = compiler.get_ipu_strategy() - ipu_strategy.is_training = self.is_training + ipu_strategy = paddle.static.IpuStrategy() + ipu_strategy.SetGraphConfig(is_training=self.is_training) program = compiler.IPUCompiledProgram( main_prog, ipu_strategy=ipu_strategy).compile(feed_list, fetch_list) diff --git a/python/paddle/fluid/tests/unittests/ipu/test_transpose_op_ipu.py b/python/paddle/fluid/tests/unittests/ipu/test_transpose_op_ipu.py index 715f81b684..77d2f41310 100644 --- a/python/paddle/fluid/tests/unittests/ipu/test_transpose_op_ipu.py +++ b/python/paddle/fluid/tests/unittests/ipu/test_transpose_op_ipu.py @@ -78,8 +78,8 @@ class TestBase(IPUOpTest): if run_ipu: feed_list = self.feed_list - ipu_strategy = compiler.get_ipu_strategy() - ipu_strategy.is_training = self.is_training + ipu_strategy = paddle.static.IpuStrategy() + ipu_strategy.SetGraphConfig(is_training=self.is_training) program = compiler.IPUCompiledProgram( main_prog, ipu_strategy=ipu_strategy).compile(feed_list, fetch_list) diff --git a/python/paddle/fluid/tests/unittests/ipu/test_unsqueeze_op_ipu.py b/python/paddle/fluid/tests/unittests/ipu/test_unsqueeze_op_ipu.py index 9d8cab6a69..75ed5a0731 100644 --- a/python/paddle/fluid/tests/unittests/ipu/test_unsqueeze_op_ipu.py +++ b/python/paddle/fluid/tests/unittests/ipu/test_unsqueeze_op_ipu.py @@ -76,8 +76,8 @@ class TestBase(IPUOpTest): if run_ipu: feed_list = self.feed_list - ipu_strategy = compiler.get_ipu_strategy() - ipu_strategy.is_training = self.is_training + ipu_strategy = paddle.static.IpuStrategy() + ipu_strategy.SetGraphConfig(is_training=self.is_training) program = compiler.IPUCompiledProgram( main_prog, ipu_strategy=ipu_strategy).compile(feed_list, fetch_list) diff --git a/python/paddle/fluid/tests/unittests/ipu/test_varname_inplace.py b/python/paddle/fluid/tests/unittests/ipu/test_varname_inplace.py index 801794804d..fabad936de 100644 --- a/python/paddle/fluid/tests/unittests/ipu/test_varname_inplace.py +++ b/python/paddle/fluid/tests/unittests/ipu/test_varname_inplace.py @@ -91,8 +91,8 @@ class TestBase(IPUOpTest): if run_ipu: feed_list = self.feed_list - ipu_strategy = compiler.get_ipu_strategy() - ipu_strategy.is_training = self.is_training + ipu_strategy = paddle.static.IpuStrategy() + ipu_strategy.SetGraphConfig(is_training=self.is_training) program = compiler.IPUCompiledProgram( main_prog, ipu_strategy=ipu_strategy).compile(feed_list, fetch_list) -- GitLab