-
Notifications
You must be signed in to change notification settings - Fork 50
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
How to infer appropriate dtype
from uint
to int
and float
to complex
?
#859
Comments
see gh-841 |
That issue covers the complex case. Once it is fixed, For the second cast, the standard works like this: >>> import array_api_strict as xp
>>> xp.asarray([0], dtype=xp.uint8) - 1
Array([255], dtype=array_api_strict.uint8) The difference is your example would make the resulting type The rule that scalars always cast to the same dtype as the array is not something that should change, so you'd want some other way to spell I think the xp.astype(x, 'signed') - 1 where The astype improvements idea should be split out into its own issue. I doubt it would be implemented for the 2024 standard release, since it hasn't even been fleshed out yet (though it's not impossible). The complex-scalar-to-float-array issue will definitely be fixed for 2024. |
gh-848 😉 (are there complexities which I haven't thought about? A review would be appreciated!) |
I would like to compute$f(x) := xi$ , $g(y) := y - 1$ where $i$ is an imaginary number, $x$ is $y$ is
float
anduint
, using array-api. However, I am not sure what is the best way to implement it. Following the type promotion rulesThis seems too redundant. What is the proper way to do this?
The text was updated successfully, but these errors were encountered: