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] No.38 Migrate paddle.stack into pir #57477

Merged
merged 3 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion python/paddle/tensor/manipulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1855,7 +1855,7 @@ def stack(x, axis=0, name=None):
"""
axis = 0 if axis is None else axis

if in_dynamic_mode():
if in_dynamic_or_pir_mode():
return _C_ops.stack(x, axis)
else:
if not isinstance(x, list) and not isinstance(x, tuple):
Expand Down
12 changes: 8 additions & 4 deletions test/legacy_test/test_stack_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,12 @@ def setUp(self):
self.attrs = {'axis': self.axis}

def test_check_output(self):
self.check_output(check_prim=True)
self.check_output(check_prim=True, check_new_ir=True)

def test_check_grad(self):
self.check_grad(self.get_x_names(), 'Y', check_prim=True)
self.check_grad(
self.get_x_names(), 'Y', check_prim=True, check_new_ir=True
)


class TestStackOp1(TestStackOpBase):
Expand Down Expand Up @@ -187,10 +189,12 @@ def setUp(self):
self.attrs = {'axis': self.axis}

def test_check_output(self):
self.check_output(check_prim=True)
self.check_output(check_prim=True, check_new_ir=True)

def test_check_grad(self):
self.check_grad(self.get_x_names(), 'Y', check_prim=True)
self.check_grad(
self.get_x_names(), 'Y', check_prim=True, check_new_ir=True
)


class TestStackAPIWithLoDTensorArray(unittest.TestCase):
Expand Down