Solved by ptrblck in post #2 
              
              
                You should transform numpy arrays to PyTorch tensors with torch.from_numpy. 
Otherwise some weird issues might occur. 
img = torch.from_numpy(img).float().to(device)