Hello,
I have a CNN code which works fine on CPU but doesn’t on multiple GPUs.
The error message is:
RuntimeError: Expected tensor for argument #1 ‘input’ to have the same device as tensor for argument #2 ‘weight’; but device 1 does not equal 0 (while checking arguments for cudnn_convolution)
Except using the following two lines in my code, I didn’t do anything specifically for the multiple GPU.
model = nn.DataParallel(model)
data, label = data.to(device), label.to(device)
I have searched around. It seems it is because the input data are not on the same GPU as the model. So in my case, how to push the data and model on the same GPU? Many thanks in advance.