Actually, if I move the “test(epoch)” out of the epoch, testing only after all epochs of training are done, then the problem is solved. But I still can’t figure out why this could work. Is it possible that with the test procedure following training could change the data we read in?