Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

conversion from existing cuda slice to ort::Value #183

Closed
edgarriba opened this issue Apr 9, 2024 · 1 comment
Closed

conversion from existing cuda slice to ort::Value #183

edgarriba opened this issue Apr 9, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request ep: cuda related to cuda execution provider p: med medium priority perf

Comments

@edgarriba
Copy link

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

@decahedron1 decahedron1 self-assigned this Apr 9, 2024
@decahedron1 decahedron1 added enhancement New feature or request perf p: med medium priority ep: cuda related to cuda execution provider labels Apr 9, 2024
@decahedron1
Copy link
Member

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()])?;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ep: cuda related to cuda execution provider p: med medium priority perf
Projects
None yet
Development

No branches or pull requests

2 participants