未验证 提交 83d0d853 编写于 作者: Y yaozhixin 提交者: GitHub

update uts p2 (#39232)

上级 42a0947e
......@@ -101,8 +101,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)
......
......@@ -97,8 +97,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)
......
......@@ -62,9 +62,14 @@ class TestFunc(unittest.TestCase):
if run_ipu:
feed_list = [image.name]
fetch_list = [out.name]
ipu_strategy = compiler.get_ipu_strategy()
ipu_strategy.is_training = False
ipu_strategy.batches_per_step = bps
ipu_strategy = paddle.static.IpuStrategy()
ipu_strategy.SetGraphConfig(
num_ipus=2,
is_training=False,
enable_manual_shard=True,
need_avg_shard=True)
ipu_strategy.SetPipeliningConfig(
enable_pipelinin=True, batches_per_step=bps)
program = compiler.IPUCompiledProgram(
main_prog, ipu_strategy=ipu_strategy).compile(feed_list,
fetch_list)
......
......@@ -83,9 +83,9 @@ class TestBase(IPUOpTest):
feed = self.feed_ipu if run_ipu else self.feed_cpu
if run_ipu:
feed_list = self.feed_list
ipu_strategy = compiler.get_ipu_strategy()
ipu_strategy.is_training = False
ipu_strategy.enable_fp16 = True
ipu_strategy = paddle.static.IpuStrategy()
ipu_strategy.SetGraphConfig(is_training=False)
ipu_strategy.SetHalfConfig(enable_fp16=True)
program = compiler.IPUCompiledProgram(
main_prog,
ipu_strategy=ipu_strategy).compile(feed_list, fetch_list)
......
......@@ -94,8 +94,9 @@ class TestBase(IPUOpTest):
exe = paddle.static.Executor(place)
exe.run(startup_prog)
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)
......@@ -123,8 +124,8 @@ class TestBase(IPUOpTest):
if run_ipu:
feed_list = feed_target_names
fetch_list = [fetch_targets[0].name]
ipu_strategy = compiler.get_ipu_strategy()
ipu_strategy.is_training = False
ipu_strategy = paddle.static.IpuStrategy()
ipu_strategy.SetGraphConfig(is_training=False)
program = compiler.IPUCompiledProgram(
inference_program,
ipu_strategy=ipu_strategy).compile(feed_list, fetch_list)
......
......@@ -59,11 +59,9 @@ class TestCastNet(unittest.TestCase):
if run_ipu:
feed_list = [image.name]
fetch_list = [loss.name]
ipu_strategy = compiler.get_ipu_strategy()
ipu_strategy.num_ipus = 2
ipu_strategy.is_training = False
ipu_strategy.enable_manual_shard = True
ipu_strategy.enable_pipelining = False
ipu_strategy = paddle.static.IpuStrategy()
ipu_strategy.SetGraphConfig(
num_ipus=2, is_training=False, enable_manual_shard=True)
program = compiler.IPUCompiledProgram(
main_prog,
ipu_strategy=ipu_strategy).compile(feed_list, fetch_list)
......
......@@ -29,7 +29,7 @@ SEED = 2021
"core is not compiled with IPU")
class TestConvNet(unittest.TestCase):
def test_training(self):
ipu_strategy = compiler.get_ipu_strategy()
ipu_strategy = paddle.static.IpuStrategy()
assert ipu_strategy.num_ipus == 1, "Default num_ipus must be 1"
assert ipu_strategy.is_training == True, "Default is_training is True"
......@@ -38,17 +38,16 @@ class TestConvNet(unittest.TestCase):
assert ipu_strategy.enable_manual_shard == False, \
"Default enable_manual_shard is False"
ipu_strategy.num_ipus = 2
ipu_strategy.SetGraphConfig(
num_ipus=2, is_training=False, enable_manual_shard=True)
ipu_strategy.SetPipeliningConfig(enable_pipelining=True)
assert ipu_strategy.num_ipus == 2, "Set num_ipus Failed"
ipu_strategy.is_training = False
assert ipu_strategy.is_training == False, "Set is_training Failed"
ipu_strategy.enable_pipelining = True
assert ipu_strategy.enable_pipelining == True, \
"Set enable_pipelining Failed"
ipu_strategy.enable_manual_shard = True
assert ipu_strategy.enable_manual_shard == True, \
"Set enable_manual_shard Failed"
......
......@@ -104,8 +104,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)
......
......@@ -79,8 +79,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)
......
......@@ -96,8 +96,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)
......
......@@ -70,8 +70,8 @@ class TestConvNet(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)
......
......@@ -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)
......
......@@ -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)
......
......@@ -86,8 +86,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)
......
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册