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]Migrate increment into pir #58245

Merged
merged 2 commits into from
Oct 23, 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/math.py
Original file line number Diff line number Diff line change
Expand Up @@ -4669,7 +4669,7 @@ def increment(x, value=1.0, name=None):
[1.])

"""
if in_dynamic_mode():
if in_dynamic_or_pir_mode():
return _C_ops.increment_(x, value)
else:
check_variable_and_dtype(
Expand Down
3 changes: 3 additions & 0 deletions test/legacy_test/test_increment.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@

import paddle
from paddle import base
from paddle.pir_utils import test_with_pir_api


class TestIncrement(unittest.TestCase):
@test_with_pir_api
def test_api(self):
with base.program_guard(base.Program(), base.Program()):
input = paddle.tensor.fill_constant(
Expand All @@ -41,6 +43,7 @@ def test_api(self):


class TestInplaceApiWithDataTransform(unittest.TestCase):
@test_with_pir_api
def test_increment(self):
if base.core.is_compiled_with_cuda():
paddle.enable_static()
Expand Down