You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: spec/API_specification/array_object.md
+15-3Lines changed: 15 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -458,6 +458,10 @@ Exports the array for consumption by {ref}`function-from_dlpack` as a DLPack cap
458
458
459
459
For other device types which do have a stream, queue or similar synchronization mechanism, the most appropriate type to use for `stream` is not yet determined. E.g., for SYCL one may want to use an object containing an in-order `cl::sycl::queue`. This is allowed when libraries agree on such a convention, and may be standardized in a future version of this API standard.
460
460
461
+
```{note}
462
+
Support for a `stream` value other than `None` is optional and implementation-dependent.
463
+
```
464
+
461
465
Device-specific notes:
462
466
463
467
:::{admonition} CUDA
@@ -1213,9 +1217,9 @@ Element-wise results must equal the results returned by the equivalent element-w
1213
1217
```
1214
1218
1215
1219
(method-to_device)=
1216
-
### to\_device(self, device, /)
1220
+
### to\_device(self, device, /, *, stream=None)
1217
1221
1218
-
Move the array to the given device.
1222
+
Copy the array from the device on which it currently resides to the specified `device`.
1219
1223
1220
1224
#### Parameters
1221
1225
@@ -1227,8 +1231,16 @@ Move the array to the given device.
1227
1231
1228
1232
- a `device` object (see {ref}`device-support`).
1229
1233
1234
+
-**stream**: _Optional\[ Union\[ int, Any ]]_
1235
+
1236
+
- stream object to use during copy. In addition to the types supported in {ref}`method-__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.
1237
+
1230
1238
#### Returns
1231
1239
1232
1240
-**out**: _<array>_
1233
1241
1234
-
- an array with the same data and dtype, located on the specified device.
1242
+
- an array with the same data and data type as `self` and located on the specified `device`.
1243
+
1244
+
```{note}
1245
+
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.
0 commit comments