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: 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
Collaborator

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
Collaborator

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants