jittor icon indicating copy to clipboard operation
jittor copied to clipboard

How to move data or model from CPU to GPU?

Open HeroesHanzo opened this issue 2 years ago • 1 comments

Dear the developers of Jittor. I'm novice in Jittor and I used to adopt Pytorch in my deep learning project. When I wanna move my data or model from CPU to GPU, I always apply .to('cuda') operation. Is there any similar function in Jittor? If not, is there any explicit operation to move the data or models from CPU to GPU? Or I just need to specify the GPU (CUDA_VISIBLE_DEVICE=XXX) before running my script without explicit movement?

I'm looking forward to your reply. Thanks for your help.

HeroesHanzo avatar Sep 20 '22 10:09 HeroesHanzo

Hello, using jt.flags.use_cuda=1 will put all arrays after this declaration to GPU.

Exusial avatar Oct 03 '22 13:10 Exusial