Skip to content
Advertisement

TypeError: expected CPU (got CUDA)

JavaScript

X_train,X_test,y_train,y_test=train_test_split(X,y,test_size=0.2,random_state=0) y_train import torch import torch.nn as nn import torch.nn.functional as F

JavaScript

when I Run this code I got this error:

JavaScript

How to can I solve this error?

Advertisement

Answer

To transfer the variables to GPU, try the following:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement