How to solve the problem of `RuntimeError: all tensors must be on devices[0]`

Is this right? I still encounter the error.

model = torch.nn.DataParallel(model.cuda(), device_ids=[0,1,2,3])

for i, (input, target) in enumerate(test_loader):
        with torch.cuda.device(0):
	        target = target.cuda(async=True) # in test loader, pin_memory = True
	        input_var = torch.autograd.Variable(input, volatile=False)