Skip to content

Commit

Permalink
fix (torch_frontend)(tensor.py): fixing the __eq__ and __ne__ met…
Browse files Browse the repository at this point in the history
…hods on the `Tensor` class to handle an edge case when `other` is an iterable.
  • Loading branch information
YushaArif99 committed Sep 27, 2024
1 parent 2e9d55f commit 524ae60
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ivy/functional/frontends/torch/tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1464,6 +1464,8 @@ def __float__(self):

@with_unsupported_dtypes({"2.2 and below": ("bfloat16",)}, "torch")
def __eq__(self, other):
if isinstance(other, (list, tuple)):
return False
return torch_frontend.eq(self, other)

@with_unsupported_dtypes({"2.2 and below": ("complex",)}, "torch")
Expand All @@ -1476,6 +1478,8 @@ def __ge__(self, other):

@with_unsupported_dtypes({"2.2 and below": ("bfloat16",)}, "torch")
def __ne__(self, other):
if isinstance(other, (list, tuple)):
return True
return self.ne(other)

@with_unsupported_dtypes({"2.2 and below": ("bfloat16",)}, "torch")
Expand Down

0 comments on commit 524ae60

Please sign in to comment.