I define a model, and use model.to(DEVICE) assign to GPU. but i always get errors below:
RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the same
This is my codes:
class BranchNet(nn.Module):
def init(self, dropout=DROPOUT, num_classes=NUM_CLASSES):
super(BranchNet, self).init()
…
DEVICE = torch.device(“cuda:2”)
model = BranchNet(dropout=dropout, num_classes=NUM_CLASSES)
model = model.to(DEVICE)
image = image.to(DEVICE)
label = label.to(DEVICE)
…