[C#] Enable copying of GPU OrtValue to CPU #21244
Labels
api:CSharp
issues related to the C# API
stale
issues that have not been addressed in a while; categorized by a bot
Describe the issue
Hey guys,
I can't seem to figure out an easy way to copy an OrtValue that's been allocated on the GPU, back to the CPU.
OrtValue has a really convenient
GetTensorDataAsSpan
API, which just seems to wrap the raw pointer into a span which obviously won't work when the pointer is for memory on the GPU.The python API has a nice copy_outputs_to_cpu API, which is exactly what I need.
Can we have the same thing added to the dotnet API ?
Either the
GetTensorDataAsSpan
API could be updated to do the copying automatically, or a newCopyOutputsToCpu
API could be added to theIOBinding
class, similar to python.To reproduce
Fails with:
Urgency
Not urgent, feature request.
Platform
Linux
OS Version
Ubuntu 20.04
ONNX Runtime Installation
Released Package
ONNX Runtime Version or Commit ID
1.18.0
ONNX Runtime API
C#
Architecture
X64
Execution Provider
CUDA
Execution Provider Library Version
CUDA 12.2
The text was updated successfully, but these errors were encountered: