@Unity05 Thanks for your suggestion.  However, if you look at value of NUM_EPOCHS variable that I set for code development and debugging purpose, I am afraid that this is not really the solution to the runtime error that I am facing now.
In other words, the runtime error happens within 1 epoch itself, not between 2 epochs