Skip to content

Commit

Permalink
[PIR]Migrate increment into pir (#58245)
Browse files Browse the repository at this point in the history
  • Loading branch information
0x45f authored Oct 23, 2023
1 parent 6363d2e commit 0b7d1d2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion python/paddle/tensor/math.py
Original file line number Diff line number Diff line change
Expand Up @@ -4681,7 +4681,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

0 comments on commit 0b7d1d2

Please sign in to comment.