pykeio / ort

A Rust wrapper for ONNX Runtime

Home Page:https://ort.pyke.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

conversion from existing cuda slice to ort::Value

edgarriba opened this issue · comments

hi! i'm working on an example integrating the crate cudarc to perform some image preprocessing using cuda kernels (resize, crop, normalize, etc), which i want to pipeline later to a ort session.

I've seen IoBinding but from the docs and examples i couldn't see any clear direction to achieve that. FYI, this the project i'm working on right now, which potentially i might adopt ort as dnn inference engine for cv tasks.

**https://github.com/kornia/kornia-rs/blob/cuda/examples/cuda_simple/src/main.rs

With 8383879:

let tensor: TensorRefMut<'_, f32> = unsafe {
TensorRefMut::from_raw(
MemoryInfo::new(AllocationDevice::CUDA, 0, AllocatorType::Device, MemoryType::Default)?,
(*device_data.device_ptr() as usize as *mut ()).cast(),
vec![1, 3, 512, 512]
)
.unwrap()
};
let outputs = model.run([tensor.into()])?;