Movatterモバイル変換


[0]ホーム

URL:


Skip to content

to_device

array.to_device(device:device,/,*,stream:int|Any|None=None)array

Copy the array from the device on which it currently resides to the specifieddevice.

Parameters:
  • self (array) – array instance.

  • device (device) – adevice object (seeDevice support).

  • stream (Optional[Union[int,Any]]) – stream object to use during copy. In addition to the types supported inarray.__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:

out (array) – an array with the same data and data type asself and located on the specifieddevice.

Notes

  • When a provideddevice object corresponds to the same device on which an array instance resides, implementations may choose to perform an explicit copy or returnself.

  • Ifstream is provided, the copy operation should be enqueued on the providedstream; 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.

Changed in version 2023.12:Clarified behavior when a provideddevice object corresponds to the device on which an array instance resides.


[8]ページ先頭

©2009-2025 Movatter.jp