Are you sure the condition is True for the train set?
if (iteration % epoch_size == 0):

Also, it’s better to post code directly, because we could run and debug it.
You can add code snippets using three backticks `.