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

[NewIR] No.30 Migrate paddle.matmul into pir #57277

Merged
merged 3 commits into from
Sep 15, 2023
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
4 changes: 2 additions & 2 deletions python/paddle/tensor/linalg.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

from ..base.data_feeder import check_dtype, check_type, check_variable_and_dtype
from ..common_ops_import import Variable
from ..framework import LayerHelper, in_dynamic_mode
from ..framework import LayerHelper, in_dynamic_mode, in_dynamic_or_pir_mode
from .creation import full
from .manipulation import cast
from .math import _get_reduce_axis
Expand Down Expand Up @@ -225,7 +225,7 @@ def matmul(x, y, transpose_x=False, transpose_y=False, name=None):
[10, 3, 5, 5]

"""
if in_dynamic_mode():
if in_dynamic_or_pir_mode():
return _C_ops.matmul(x, y, transpose_x, transpose_y)
else:
attrs = {
Expand Down
10 changes: 8 additions & 2 deletions test/legacy_test/test_matmul_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,15 @@ def setUp(self):
self.outputs = {'Out': Out}

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

def test_check_grad_normal(self):
self.check_grad(
['X', 'Y'], 'Out', max_relative_error=1e-3, check_cinn=True
['X', 'Y'],
'Out',
max_relative_error=1e-3,
check_cinn=True,
check_new_ir=True,
)

def test_check_grad_ignore_x(self):
Expand All @@ -108,6 +112,7 @@ def test_check_grad_ignore_x(self):
max_relative_error=1e-3,
no_grad_set=set("X"),
check_cinn=True,
check_new_ir=True,
)

def test_check_grad_ignore_y(self):
Expand All @@ -117,6 +122,7 @@ def test_check_grad_ignore_y(self):
max_relative_error=1e-3,
no_grad_set=set('Y'),
check_cinn=True,
check_new_ir=True,
)


Expand Down