From 83453844a342974902cdb31bbadfbb8fabc7ec65 Mon Sep 17 00:00:00 2001 From: 0x45f Date: Thu, 19 Oct 2023 09:55:38 +0000 Subject: [PATCH] [PIR]Migrate increment into pir --- python/paddle/tensor/math.py | 2 +- test/legacy_test/test_increment.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/python/paddle/tensor/math.py b/python/paddle/tensor/math.py index 75a0e714ba4a7..50f5bea5aebeb 100644 --- a/python/paddle/tensor/math.py +++ b/python/paddle/tensor/math.py @@ -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( diff --git a/test/legacy_test/test_increment.py b/test/legacy_test/test_increment.py index 4887564e9b9bb..3055ffe1bdcf3 100755 --- a/test/legacy_test/test_increment.py +++ b/test/legacy_test/test_increment.py @@ -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( @@ -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()