Skip to content

Commit c1e04db

Browse files
committed
Add note regarding copy behavior when moving to same device
Closes: data-apis#645
1 parent 95332bb commit c1e04db

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/array_api_stubs/_draft/array_object.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -1086,8 +1086,11 @@ def to_device(
10861086
an array with the same data and data type as ``self`` and located on the specified ``device``.
10871087
10881088
1089-
.. note::
1090-
If ``stream`` is given, the copy operation should be enqueued on the provided ``stream``; otherwise, the copy operation should be enqueued on the default stream/queue. Whether the copy is performed synchronously or asynchronously is implementation-dependent. Accordingly, if synchronization is required to guarantee data safety, this must be clearly explained in a conforming library's documentation.
1089+
Notes
1090+
-----
1091+
1092+
- When a provided ``device`` object corresponds to the same device on which an array instance resides, implementations may choose to perform an explicit copy or return ``self``.
1093+
- If ``stream`` is provided, the copy operation should be enqueued on the provided ``stream``; otherwise, the copy operation should be enqueued on the default stream/queue. Whether the copy is performed synchronously or asynchronously is implementation-dependent. Accordingly, if synchronization is required to guarantee data safety, this must be clearly explained in a conforming array library's documentation.
10911094
"""
10921095

10931096

0 commit comments

Comments
 (0)