CUDA error an illegal memory access was encountered

When I train a model(GPU),it works fine in the first epoch(not iteration), but during the second epoch, inputs = inputs.to(device) gets error

If you are not using the latest PyTorch release, could you update to the latest stable version and rerun the code, please?
If you are still facing this error, could you post an executable code snippet to reproduce it so that we could debug it?