RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:1 and cuda:0! (when checking arugment for argument target in method wrapper_nll_loss_forward)
from torchvision.models.resnet import ResNet, Bottleneck
import torch.nn as nn
num_classes = 2
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:1 and cuda:0! (when checking arugment for argument target in method wrapper_nll_loss_forward)
from torchvision.models.resnet import ResNet, Bottleneck import torch.nn as nn num_classes = 2
class CNN(ResNet): def init(self, *args, *kwargs): super(CNN, self).init( Bottleneck, [3, 4, 6, 3], num_classes=num_classes, args, **kwargs)
from torch.autograd import Variable num_epochs = 10 def train(num_epochs, cnn, loaders):
train(num_epochs, cnn, loaders)