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

Non-canonical weak types can lead to failed promotion #6051

Closed
jakevdp opened this issue Mar 12, 2021 · 1 comment · Fixed by #6068
Closed

Non-canonical weak types can lead to failed promotion #6051

jakevdp opened this issue Mar 12, 2021 · 1 comment · Fixed by #6068
Assignees
Labels
bug Something isn't working

Comments

@jakevdp
Copy link
Collaborator

jakevdp commented Mar 12, 2021

from jax import lax
x = lax.convert_element_type(1, 'int16', weak_type=True)
print(x)
# DeviceArray(1, dtype=int16)

print(x + 1)
# TypeError: add requires arguments to have the same dtypes, got int16, int32.

The reason this happens is due to something @mattjj noted in #6000; dtypes.result_type essentially canonicalizes all weak types before doing any promotion

@jakevdp jakevdp added the bug Something isn't working label Mar 12, 2021
@jakevdp jakevdp self-assigned this Mar 12, 2021
@jakevdp
Copy link
Collaborator Author

jakevdp commented Mar 12, 2021

Might also be related to #6018...

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

Successfully merging a pull request may close this issue.

1 participant