Skip to content

Commit a902944

Browse files
authored
Add note regarding copy behavior when moving to same device (#742)
Closes: #645
1 parent 83420d2 commit a902944

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
@@ -1140,8 +1140,11 @@ def to_device(
11401140
an array with the same data and data type as ``self`` and located on the specified ``device``.
11411141
11421142
1143-
.. note::
1144-
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.
1143+
Notes
1144+
-----
1145+
1146+
- 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``.
1147+
- 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.
11451148
"""
11461149

11471150

0 commit comments

Comments
 (0)