Skip to content
New issue

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

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

Already on GitHub? # to your account

BUG: Compute-follows-data breaks on the inverse operation #1405

Open
samaid opened this issue May 17, 2023 · 2 comments
Open

BUG: Compute-follows-data breaks on the inverse operation #1405

samaid opened this issue May 17, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@samaid
Copy link
Contributor

samaid commented May 17, 2023

x = dpnp.asarray([1.0, 2.0, 3.0])
y = 1.0/x

y is numpy array vs. dpnp array

Complete reproducer is here https://gist.github.com/samaid/b4510dbcd7285ceed36b42dd96acf30c

@npolina4
Copy link
Contributor

npolina4 commented May 17, 2023

Problem in type operator:

In: type(dpnp.float32(1.0))
Out: <class 'numpy.float32'>
In: dpnp.float32(1.0) / x
Out: array([array(1.), array(0.5), array(0.33333333)], dtype=object)

@npolina4
Copy link
Contributor

To avoid this problem you can use:

y = np.asarray(1.0, dtype=np.float32) / x

instead of

y = np.float32(1.0) / x

@npolina4 npolina4 added the bug Something isn't working label May 17, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants