From 897f63b468bfa649527b7ae183c9fe37a4309162 Mon Sep 17 00:00:00 2001 From: Leo Chen Date: Mon, 10 Jan 2022 11:31:04 +0800 Subject: [PATCH] [new-exec] refine ut (#38798) --- .../interpreter/test_standalone_executor.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/python/paddle/fluid/tests/unittests/interpreter/test_standalone_executor.py b/python/paddle/fluid/tests/unittests/interpreter/test_standalone_executor.py index 01b2cccfc48..48f95472c7e 100644 --- a/python/paddle/fluid/tests/unittests/interpreter/test_standalone_executor.py +++ b/python/paddle/fluid/tests/unittests/interpreter/test_standalone_executor.py @@ -32,18 +32,16 @@ class LinearTestCase(unittest.TestCase): self.place.set_place(place) def build_program(self): - a = paddle.static.data(name="a", shape=[2, 2], dtype='float32') - b = paddle.ones([2, 2]) * 2 - t = paddle.static.nn.fc(a, 2) - c = t + b - - main_program = paddle.fluid.default_main_program() - startup_program = paddle.fluid.default_startup_program() + startup_program = paddle.static.Program() + main_program = paddle.static.Program() + with paddle.static.program_guard(main_program, startup_program): + a = paddle.static.data(name="a", shape=[2, 2], dtype='float32') + b = paddle.ones([2, 2]) * 2 + t = paddle.static.nn.fc(a, 2) + c = t + b return startup_program, main_program, c - return standaloneexecutor, c - def test_interp_base(self): startup_program, main_program, c = self.build_program() standaloneexecutor = StandaloneExecutor( -- GitLab