In PyTorch, what is the difference between the following two methods in sending a tensor (or model) to GPU:
Setup:
X = np.array([[1, 3, 2, 3], [2, 3, 5, 6], [1, 2, 3, 4]]) # X = model()
X = torch.DoubleTensor(X)
Method 1 |
Method 2 |
X.cuda() |
device = torch.device("cuda:0")
X = X.to(device) |
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…