To(device) changes the value of input

I found this problem has to do with pin_memory=True in DataLoader.
When I set pin_memory=False, the problem gone.

Can I know why does this problem occur when pin_memory=True?