x = torch.cuda.FloatTensor(2,2) 결과 tensor([[0,0],[0,0]], device = 'cuda:0')
다만, 서로 다른 장치에 올라가 있는 텐서끼리는 연산이 안됨.
x = x.cuda()를 해도 gpu사용됨 x = x.cuda(device =1)로 인덱스 변경가능
import torch.nn as nn layer = nn.Linear(2,2) layer.cuda(0)
x = x.cpu()