다루는 텐서가 어디에 저장되느냐에 따라 CPU tensor, GPU tensor로 구분되고 CPU에 저장된 것을 GPU로, GPU에 저장된 것을 CPU로 옮기는 것도 가능하다.
다만 GPU tensor라는 말보다는 CUDA tensor라는 말이 더 자주 사용되는 듯?
import torch
a = torch.tensor([1, 2, 3, 4])
a.device
tensor.device하면 tensor가 CPU에 저장되어 있는지 GPU에 저장되어 있는지 확인할 수 있다.
CUDA (Compute Unified Device Architecture) 란, GPU에서 수행하는 병렬 처리 알고리즘을 프로그래밍 언어를 사용하여 작성할 수 있도록 하는 기술이다.
torch.cuda.is_available()torch.cuda.get_device_name(device=0)torch.cuda.device_count()a = torch.tensor([1, 2, 3])
a = torch.tensor([1, 2, 3, 4]).to('cuda')
a = torch.tensor([1, 2, 3, 4]).cuda()
b = a.to(device='cpu')
b = a.cpu()
https://statisticsplaybook.tistory.com/47
https://ko.wikipedia.org/wiki/CUDA