Skip to content

Commit d75a88a

Browse files
0x45fjiahy0825
authored andcommitted
[PIR]Migrate increment into pir (PaddlePaddle#58245)
1 parent fba8f03 commit d75a88a

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

python/paddle/tensor/math.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4681,7 +4681,7 @@ def increment(x, value=1.0, name=None):
46814681
[1.])
46824682
46834683
"""
4684-
if in_dynamic_mode():
4684+
if in_dynamic_or_pir_mode():
46854685
return _C_ops.increment_(x, value)
46864686
else:
46874687
check_variable_and_dtype(

test/legacy_test/test_increment.py

+3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@
1818

1919
import paddle
2020
from paddle import base
21+
from paddle.pir_utils import test_with_pir_api
2122

2223

2324
class TestIncrement(unittest.TestCase):
25+
@test_with_pir_api
2426
def test_api(self):
2527
with base.program_guard(base.Program(), base.Program()):
2628
input = paddle.tensor.fill_constant(
@@ -41,6 +43,7 @@ def test_api(self):
4143

4244

4345
class TestInplaceApiWithDataTransform(unittest.TestCase):
46+
@test_with_pir_api
4447
def test_increment(self):
4548
if base.core.is_compiled_with_cuda():
4649
paddle.enable_static()

0 commit comments

Comments
 (0)