Since I had this problem but this solution did not work for me (possibly because Variable usage is now deprecated) the solution was to load the tensor onto the cpu via the map_location argument. When using dataloader with torch.multiprocessing, loading the tensor to gpu (which was being done automatically) caused this issue. Testing without torch.multiprocessing and this error did not occur.