No way to copy a tensor from gpu to cpu to pre allocated array.
Open
- Dominant language
- C#
- Stars
- 1.9k
- Forks
- 228
- PR merge metrics
- No merged PRs in 30d
Description
Doesnt appear to be any way to transfer a result tensor in to an existing cpu float array. Below requires new memory allocation.
var cpuResult = gpuResult.cpu();
float[] result = cpuResult.data().ToArray();
If this is part of a loop, this is a lot of wasted memory allocation and time! Below is how libraries normally do things. eg. CUDA.
float[] cpuResult ..... (pre allocated further up)
gpuResult.CopyToHost(cpuResult);
Maybe I missed this CopyTo because its kinda essential for any gpu type library (?!)
Is this project maintained?
Contributor guide
Assessment
This issue has not been assessed yet.