From c29783349cc193d19026de40c2aec2db063bd6a8 Mon Sep 17 00:00:00 2001 From: enkilee Date: Tue, 24 Oct 2023 03:12:15 +0000 Subject: [PATCH 1/2] fix --- python/paddle/tensor/logic.py | 12 ++++++------ test/legacy_test/test_bitwise_op.py | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/python/paddle/tensor/logic.py b/python/paddle/tensor/logic.py index 9b50993b891667..2199cd9d3af767 100755 --- a/python/paddle/tensor/logic.py +++ b/python/paddle/tensor/logic.py @@ -1213,7 +1213,7 @@ def bitwise_or(x, y, out=None, name=None): Tensor(shape=[3], dtype=int64, place=Place(cpu), stop_gradient=True, [-1, -1, -3]) """ - if in_dynamic_mode() and out is None: + if in_dynamic_or_pir_mode() and out is None: return _C_ops.bitwise_or(x, y) return _bitwise_op( @@ -1234,7 +1234,7 @@ def bitwise_or_(x, y, name=None): out_shape, x.shape ) ) - if in_dynamic_mode(): + if in_dynamic_or_pir_mode(): return _C_ops.bitwise_or_(x, y) @@ -1272,7 +1272,7 @@ def bitwise_xor(x, y, out=None, name=None): Tensor(shape=[3], dtype=int64, place=Place(cpu), stop_gradient=True, [-1, -3, -4]) """ - if in_dynamic_mode() and out is None: + if in_dynamic_or_pir_mode() and out is None: return _C_ops.bitwise_xor(x, y) return _bitwise_op( op_name="bitwise_xor", x=x, y=y, name=name, out=out, binary_op=True @@ -1292,7 +1292,7 @@ def bitwise_xor_(x, y, name=None): out_shape, x.shape ) ) - if in_dynamic_mode(): + if in_dynamic_or_pir_mode(): return _C_ops.bitwise_xor_(x, y) @@ -1328,7 +1328,7 @@ def bitwise_not(x, out=None, name=None): Tensor(shape=[3], dtype=int64, place=Place(cpu), stop_gradient=True, [ 4, 0, -2]) """ - if in_dynamic_mode() and out is None: + if in_dynamic_or_pir_mode() and out is None: return _C_ops.bitwise_not(x) return _bitwise_op( @@ -1342,7 +1342,7 @@ def bitwise_not_(x, name=None): Inplace version of ``bitwise_not`` API, the output Tensor will be inplaced with input ``x``. Please refer to :ref:`api_paddle_bitwise_not`. """ - if in_dynamic_mode(): + if in_dynamic_or_pir_mode(): return _C_ops.bitwise_not_(x) diff --git a/test/legacy_test/test_bitwise_op.py b/test/legacy_test/test_bitwise_op.py index 21a7abe812ad7a..eb3ec980f05fdb 100644 --- a/test/legacy_test/test_bitwise_op.py +++ b/test/legacy_test/test_bitwise_op.py @@ -150,7 +150,7 @@ 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_pir=True) def test_check_grad(self): pass @@ -258,7 +258,7 @@ 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_pir=True) def test_check_grad(self): pass @@ -363,7 +363,7 @@ 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_pir=True) def test_check_grad(self): pass From ab9a1742609572d57ac5e3a1cc5f5c50d81f4884 Mon Sep 17 00:00:00 2001 From: enkilee Date: Thu, 26 Oct 2023 02:09:32 +0000 Subject: [PATCH 2/2] undo _ --- python/paddle/tensor/logic.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/paddle/tensor/logic.py b/python/paddle/tensor/logic.py index 2199cd9d3af767..16281155d0baf4 100755 --- a/python/paddle/tensor/logic.py +++ b/python/paddle/tensor/logic.py @@ -1234,7 +1234,7 @@ def bitwise_or_(x, y, name=None): out_shape, x.shape ) ) - if in_dynamic_or_pir_mode(): + if in_dynamic_mode(): return _C_ops.bitwise_or_(x, y) @@ -1292,7 +1292,7 @@ def bitwise_xor_(x, y, name=None): out_shape, x.shape ) ) - if in_dynamic_or_pir_mode(): + if in_dynamic_mode(): return _C_ops.bitwise_xor_(x, y) @@ -1342,7 +1342,7 @@ def bitwise_not_(x, name=None): Inplace version of ``bitwise_not`` API, the output Tensor will be inplaced with input ``x``. Please refer to :ref:`api_paddle_bitwise_not`. """ - if in_dynamic_or_pir_mode(): + if in_dynamic_mode(): return _C_ops.bitwise_not_(x)