CVCUDA / CV-CUDA

CV-CUDA™ is an open-source, GPU accelerated library for cloud-scale image processing and computer vision.
https://cvcuda.github.io
Other
2.37k stars 217 forks source link

[FEATURE]libtorch interface #20

Closed tp-nan closed 5 months ago

tp-nan commented 1 year ago

At this moment, CudaBuffer can be converted to torch.Tensor through __cuda_array_interface__. However, sometimes we have to use libtorch(at::Tensor/torch::Tensor). Is it possible to make a libtorch interface for nvcv::Tensor/ITensor ?

tp-nan commented 10 months ago

To have DLPack support for C++ API would be great, like

 DLManagedTensor* fromNvcvTensor(const nvcv::Tensor& src) ;
...

An example is from pytorch:

https://github.com/Tabrizian/pytorch/blob/5c5f53ef6645016794b2e0c9a267ccb095995ea5/aten/src/ATen/DLConvertor.cpp#L244

SongDabao commented 9 months ago

At this moment, CudaBuffer can be converted to torch.Tensor through __cuda_array_interface__. However, sometimes we have to use libtorch(at::Tensor/torch::Tensor). Is it possible to make a libtorch interface for nvcv::Tensor/ITensor ?

I'm having the same problem now, how did you solve it? Thanks!

tp-nan commented 9 months ago

At this moment, CudaBuffer can be converted to torch.Tensor through __cuda_array_interface__. However, sometimes we have to use libtorch(at::Tensor/torch::Tensor). Is it possible to make a libtorch interface for nvcv::Tensor/ITensor ?

I'm having the same problem now, how did you solve it? Thanks!

I wrote a libtorch interface here toNvcvTensor and fromNvcvTensor , for Tensor2NvTensor and NvTensor2Tensor backends

shiremathNV commented 9 months ago

@dlesage-nvidia @pmikolajczyk