Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Dy2St][PIR] Enable some dy2st control flow unittests #61370

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions test/dygraph_to_static/test_break_continue.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
Dy2StTestBase,
enable_to_static_guard,
test_ast_only,
test_legacy_and_pt,
test_legacy_and_pt_and_pir,
)

Expand All @@ -37,6 +36,7 @@ def setUp(self):
self.error = "Your if/else have different number of return value."

@test_ast_only
@test_legacy_and_pt_and_pir
def test_error(self):
if self.dyfunc:
with self.assertRaisesRegex(Dygraph2StaticException, self.error):
Expand Down Expand Up @@ -241,8 +241,8 @@ def test_transformed_static_result(self):
)


# TODO(pir-control-flow): Fix this after we support control-flow in PIR
class TestContinueNotPirBase(TestContinueInFor):
@test_legacy_and_pt_and_pir
def test_transformed_static_result(self):
self.init_dygraph_func()
dygraph_res = self.run_dygraph_mode()
Expand Down Expand Up @@ -354,8 +354,7 @@ class TestOptimBreakInWhile(TestContinueInWhile):
def init_dygraph_func(self):
self.dygraph_func = test_optim_break_in_while

# TODO: Open PIR test when while_loop dy2st fixed
@test_legacy_and_pt
@test_legacy_and_pt_and_pir
def test_transformed_static_result(self):
self.init_dygraph_func()
dygraph_res = self.run_dygraph_mode()
Expand Down
1 change: 1 addition & 0 deletions test/dygraph_to_static/test_jit_setitem.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ def run_dygraph(self, func):
y = func()
return (y,)

@test_legacy_and_pt_and_pir
def test_case(self):
func = self.init_func()
dy_res = self.run_dygraph(func)
Expand Down
8 changes: 7 additions & 1 deletion test/dygraph_to_static/test_write_python_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@

import unittest

from dygraph_to_static_utils import Dy2StTestBase, test_ast_only, test_sot_only
from dygraph_to_static_utils import (
Dy2StTestBase,
test_ast_only,
test_legacy_and_pt_and_pir,
test_sot_only,
)

import paddle

Expand Down Expand Up @@ -113,6 +118,7 @@ def get_raw_value(self, container, getitem_path):
return out

@test_sot_only
@test_legacy_and_pt_and_pir
def test_write_container_sot(self):
func_static = paddle.jit.to_static(self.func)
input = paddle.to_tensor([1, 2, 3])
Expand Down