CV-CUDA
CV-CUDA copied to clipboard
[QUESTION] torch.as_tensor(nvcv.Tensor.cuda()) copy the data from gpu to cpu?
What is your question? Great work on acceleration on CV tasks! But I find when I convert a nvcv.Tensor to torch.Tensor, it will copy the data in GPU to CPU. Is it a bug? Or any memory consideration?
a = torch.randn(10, 256, 256, 3).to('cuda') # GPU
a_n = nvcv.as_tensor(a, 'NHWC') # GPU
b = torch.as_tensor(a_n.cuda()) # CPU
Env Info: RTX 4090, PyTorch 2.0.1
Another question, can I convert ImageBatchVatShape to nvcv.Tensor or torch.Tensor directly? As far as I know, I have to process it one by one.
Another question, can I convert ImageBatchVatShape to nvcv.Tensor or torch.Tensor directly? As far as I know, I have to process it one by one.
+1
In examples they do torch.as_tensor(a_n.cuda(), device='cuda'), but i haven't tested if that writes back to the gpu first or not