Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Heat operators eq, ne should allow non-array operands #1292

Open
ClaudiaComito opened this issue Dec 8, 2023 · 1 comment
Open

[Bug]: Heat operators eq, ne should allow non-array operands #1292

ClaudiaComito opened this issue Dec 8, 2023 · 1 comment
Labels
bug Something isn't working relational stale

Comments

@ClaudiaComito
Copy link
Contributor

ClaudiaComito commented Dec 8, 2023

What happened?

Relational operators in Heat are treated as binary (element-wise) operations just like arithmetic operations. It follows that, currently, only array-like operands are supported.

This is overly restrictive, we want to be able to run comparisons similar to those shown below without raising an exception:

import heat as ht

>>> a = ht.arange(10)
>>> a == slice(None)
False
>>> a == ...
False
>>> a != slice(None)
True
>>> a != ...
True

Code snippet triggering the error

import heat as ht

a = ht.arange(10)
a == slice(None)

Error message or erroneous outcome

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/c.comito/devel/local/heat/heat/core/relational.py", line 76, in <lambda>
    DNDarray.__eq__ = lambda self, other: eq(self, other)
  File "/Users/c.comito/devel/local/heat/heat/core/relational.py", line 60, in eq
    res = _operations.__binary_op(torch.eq, x, y)
  File "/Users/c.comito/devel/local/heat/heat/core/_operations.py", line 82, in __binary_op
    raise TypeError(
TypeError: Only DNDarrays and numeric scalars are supported, but input was <class 'slice'>

Version

1.3.x

Python version

3.10

PyTorch version

2.0

MPI version

doesn't matter
@ClaudiaComito ClaudiaComito added bug Something isn't working relational labels Dec 8, 2023
Copy link
Contributor

This issue is stale because it has been open for 60 days with no activity.

@github-actions github-actions bot added the stale label Feb 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working relational stale
Projects
None yet
Development

No branches or pull requests

1 participant