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

[QUESTION] torch.as_tensor(nvcv.Tensor.cuda()) copy the data from gpu to cpu? #104

Open
QinlongHuang opened this issue Aug 24, 2023 · 2 comments
Labels
? - needs triage question Further information is requested

Comments

@QinlongHuang
Copy link

QinlongHuang commented Aug 24, 2023

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

@QinlongHuang QinlongHuang added ? - needs triage question Further information is requested labels Aug 24, 2023
@QinlongHuang
Copy link
Author

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.

@lokvke
Copy link

lokvke commented Apr 25, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
? - needs triage question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants