copyDataFromDeviceMemory(toBytes:length:synchronizeWithDevice:)
Copies tensor data from device memory to user-specified memory.
Declaration
func copyDataFromDeviceMemory(toBytes bytes: UnsafeMutableRawPointer, length: Int, synchronizeWithDevice: Bool) -> BoolParameters
- bytes:
The data to copy.
- length:
The number of bytes you specify for the framework to copy.
- synchronizeWithDevice:
A Boolean that indicates whether you choose to synchronize device memory if the device is a GPU.
Return Value
true if successful; otherwise, false if the framework failed to copy or synchronize.
Discussion
When the device is a GPU, you may need to synchronize the device memory, that is, set synchronizeWithDevice to true. The framework ignores synchronizeWithDevice when the device is the CPU.