Skip to content

Commit e99885f

Browse files
authored
【PIR API adaptor No.24-26】Migrate paddle.bitwise_not/bitwise_or/bitwise_xor into pir (#58331)
1 parent 11614e6 commit e99885f

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

python/paddle/tensor/logic.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,7 +1213,7 @@ def bitwise_or(x, y, out=None, name=None):
12131213
Tensor(shape=[3], dtype=int64, place=Place(cpu), stop_gradient=True,
12141214
[-1, -1, -3])
12151215
"""
1216-
if in_dynamic_mode() and out is None:
1216+
if in_dynamic_or_pir_mode() and out is None:
12171217
return _C_ops.bitwise_or(x, y)
12181218

12191219
return _bitwise_op(
@@ -1272,7 +1272,7 @@ def bitwise_xor(x, y, out=None, name=None):
12721272
Tensor(shape=[3], dtype=int64, place=Place(cpu), stop_gradient=True,
12731273
[-1, -3, -4])
12741274
"""
1275-
if in_dynamic_mode() and out is None:
1275+
if in_dynamic_or_pir_mode() and out is None:
12761276
return _C_ops.bitwise_xor(x, y)
12771277
return _bitwise_op(
12781278
op_name="bitwise_xor", x=x, y=y, name=name, out=out, binary_op=True
@@ -1328,7 +1328,7 @@ def bitwise_not(x, out=None, name=None):
13281328
Tensor(shape=[3], dtype=int64, place=Place(cpu), stop_gradient=True,
13291329
[ 4, 0, -2])
13301330
"""
1331-
if in_dynamic_mode() and out is None:
1331+
if in_dynamic_or_pir_mode() and out is None:
13321332
return _C_ops.bitwise_not(x)
13331333

13341334
return _bitwise_op(

test/legacy_test/test_bitwise_op.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def setUp(self):
150150
self.outputs = {'Out': out}
151151

152152
def test_check_output(self):
153-
self.check_output(check_cinn=True)
153+
self.check_output(check_cinn=True, check_pir=True)
154154

155155
def test_check_grad(self):
156156
pass
@@ -258,7 +258,7 @@ def setUp(self):
258258
self.outputs = {'Out': out}
259259

260260
def test_check_output(self):
261-
self.check_output(check_cinn=True)
261+
self.check_output(check_cinn=True, check_pir=True)
262262

263263
def test_check_grad(self):
264264
pass
@@ -363,7 +363,7 @@ def setUp(self):
363363
self.outputs = {'Out': out}
364364

365365
def test_check_output(self):
366-
self.check_output(check_cinn=True)
366+
self.check_output(check_cinn=True, check_pir=True)
367367

368368
def test_check_grad(self):
369369
pass

0 commit comments

Comments
 (0)