-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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: array_api stream
has wrong type
#24642
Comments
The EDIT: Arguably would be more accurate to type it upstream as a free parameter, e.g. a union between |
The note only talks about the implementation for a
|
That's in practice purely academic difference? The only member of the |
I wouldn't call this an academic difference since It seems to me that the issue here is with the API spec though. It's not clear whether the I'd argue that the following are quite different: def f(x: int | None = None) -> Any:
# Probably the variant that should generally be preferred.
if x is not None:
raise NotImplementedError('We don't support this.')
return do_something(x) def g(x: int | None = None) -> Any:
# Not ideal, but valid. Spec doesn't require handling the not-None case.
return do_something(x) # Undefined behavior, but fine per spec. def h(x: None = None) -> Any: # Wrong. Doesn't match type signature.
return do_something(x) I would assume that the spec means the optional in the sense of If cc @rgommers |
All these signatures use positional arguments, so this doesn't make sense to me. It's a keyword argument with a default of |
My bad those were meant to be kwargs. I've updated my previous comment. |
Okay, after some more thought:
It is a goal to have the whole standard be type-safe/stable/checkable.
That should be |
Describe the issue:
According to the spec the
stream
parameter for__dlpack__
andto_device
should beOptional[Union[int, Any]]
. The current implementation just usesNone
.Reproduce the code example:
Error message:
Runtime information:
1.25.1
3.11.4 (main, Jun 6 2023, 22:16:46) [GCC 12.3.0]
Context for the issue:
Loosely related to #24641
__dlpack__
: https://data-apis.org/array-api/latest/API_specification/generated/array_api.array.__dlpack__.htmlto_device
: https://data-apis.org/array-api/latest/API_specification/generated/array_api.array.to_device.htmlThe text was updated successfully, but these errors were encountered: