I am using GridSearchCV for cross validation as indicated here (https://github.com/skorch-dev/skorch 51). However it seems like I am not able to pass X and y as pytorch tensors loaded in cuda. This is my unsuccessful attempt:
device = “cuda”
X = torch.from_numpy(X).to(device)
y = torch.from_numpy(y).to(device)
gs.fit(X, y)
The error I get is “can’t convert CUDA tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.”.  This appears during gs.fit(X, y). Of course if I convert this to cpu() it works but that defeats the purpose because I’d like to avoid data transfers from memory to the gpu. Anything I am missing?