Solved by InnovArul in post #2 
              
              
                The test code that you have added at the end may use random generator which influences the training data selection from epoch-2. If you really want the previous behavior, Can you save and set the random number generator state before and after your test code? 
using  torch.get_rng_state and   torch.s…