Skip to content

Add an Array Protocol & improve static typing support #589

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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Correct type hints in to_device and dlpack
Signed-off-by: nstarman <nstarman@users.noreply.github.com>
  • Loading branch information
nstarman committed Nov 24, 2024
commit 950fe94a775ac48b2e94508803399bfa91e0ffcd
6 changes: 3 additions & 3 deletions src/array_api_stubs/_draft/array_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ def __dlpack__(
self,
/,
*,
stream: int | Any | None = None,
stream: Any | None = None,
max_version: tuple[int, int] | None = None,
dl_device: tuple[Enum, int] | None = None,
copy: bool | None = None,
Expand Down Expand Up @@ -1247,7 +1247,7 @@ def __xor__(self: array, other: int | bool | array, /) -> array:
...

def to_device(
self: array, device: "Device", /, *, stream: int | Any | None = None # type: ignore[type-var]
self: array, device: "Device", /, *, stream: Any | None = None # type: ignore[type-var]
) -> array:
"""
Copy the array from the device on which it currently resides to the specified ``device``.
Expand All @@ -1258,7 +1258,7 @@ def to_device(
array instance.
device: device
a ``device`` object (see :ref:`device-support`).
stream: Optional[Union[int, Any]]
stream: Optional[Any]
stream object to use during copy. In addition to the types supported in :meth:`Array.__dlpack__`, implementations may choose to support any library-specific stream object with the caveat that any code using such an object would not be portable.

Returns
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy