Skip to content

Commit 9365930

Browse files
committed
update
1 parent 1d70daf commit 9365930

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

python/paddle/pir/math_op_patch.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,13 @@ def __impl__(self, other_var):
504504
# but only +, -, *, / can use this method
505505
if scalar_method is not None:
506506
return scalar_method(self, other_var)
507+
elif other_var is None:
508+
if method_name == "__eq__":
509+
return False
510+
elif method_name == "__ne__":
511+
return True
512+
else:
513+
pass
507514
else:
508515
# do nothing
509516
pass

python/paddle/tensor/logic.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -584,8 +584,6 @@ def equal(x: Tensor, y: Tensor, name: str | None = None) -> Tensor:
584584
if not isinstance(
585585
y, (int, bool, float, Variable, complex, paddle.pir.Value)
586586
):
587-
if y is None:
588-
return False
589587
raise TypeError(
590588
f"Type of input args must be float, bool, complex, int or Tensor, but received type {type(y)}"
591589
)
@@ -1113,8 +1111,6 @@ def not_equal(x: Tensor, y: Tensor, name: str | None = None) -> Tensor:
11131111
Tensor(shape=[3], dtype=bool, place=Place(cpu), stop_gradient=True,
11141112
[False, True , True ])
11151113
"""
1116-
if y is None:
1117-
return True
11181114
if in_dynamic_or_pir_mode():
11191115
return _C_ops.not_equal(x, y)
11201116
else:

0 commit comments

Comments
 (0)