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

[PIR] Open PIR flag for test_ifelse #60685

Merged
merged 3 commits into from
Jan 10, 2024
Merged
Changes from all commits
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
20 changes: 6 additions & 14 deletions test/dygraph_to_static/test_ifelse.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def _run_dygraph(self, to_static=False):
ret = self.dyfunc(x_v)
return ret.numpy()

@test_legacy_and_pt_and_pir
def test_ast_to_func(self):
self.assertTrue((self._run_dygraph() == self._run_static()).all())

Expand All @@ -113,6 +114,7 @@ def setUp(self):

# TODO(dev): fix AST mode
@disable_test_case((ToStaticMode.AST, IrMode.PT))
@test_legacy_and_pt_and_pir
def test_ast_to_func(self):
self.assertTrue((self._run_dygraph() == self._run_static()).all())

Expand All @@ -134,8 +136,7 @@ def _run_dygraph(self, to_static=False):
ret = self.dyfunc(x_v)
return ret.numpy()

# Why add test_legacy_only? : PIR not support if true and false branch output with different rank
@test_legacy_only
@test_legacy_and_pt_and_pir
def test_ast_to_func(self):
self.assertTrue((self._run_dygraph() == self._run_static()).all())

Expand Down Expand Up @@ -173,8 +174,7 @@ def _run_dygraph(self, to_static=False):
ret = self.dyfunc(x_v)
return ret.numpy()

# Why add test_legacy_only? : PIR not support if true and false branch output with different rank
@test_legacy_only
@test_legacy_and_pt_and_pir
def test_ast_to_func(self):
self.assertTrue((self._run_dygraph() == self._run_static()).all())

Expand Down Expand Up @@ -206,8 +206,7 @@ def _run_dygraph(self, to_static=False):
ret = self.dyfunc(x_v)
return ret.numpy()

# Why add test_legacy_only? : PIR not support if true and false branch output with different rank
@test_legacy_only
@test_legacy_and_pt_and_pir
def test_ast_to_func(self):
self.assertTrue((self._run_dygraph() == self._run_static()).all())

Expand Down Expand Up @@ -285,20 +284,12 @@ def setUp(self):
self.x = np.random.random([10, 16]).astype('float32')
self.dyfunc = if_with_and_or_2

@test_legacy_and_pt_and_pir
def test_ast_to_func(self):
self.assertTrue((self._run_dygraph() == self._run_static()).all())


class TestDygraphIfElseWithAndOr3(TestDygraphIfElse):
def setUp(self):
self.x = np.random.random([10, 16]).astype('float32')
self.dyfunc = if_with_and_or_3

@test_legacy_and_pt_and_pir
def test_ast_to_func(self):
self.assertTrue((self._run_dygraph() == self._run_static()).all())


class TestDygraphIfElseWithAndOr4(TestDygraphIfElse):
def setUp(self):
Expand Down Expand Up @@ -413,6 +404,7 @@ def setUp(self):
self.x = np.random.random([10, 16]).astype('float32')
self.Net = NetWithExternalFunc

@test_legacy_and_pt_and_pir
def test_ast_to_func(self):
self.assertTrue((self._run_dygraph() == self._run_static()).all())

Expand Down