Hi,
There is a small mistake in the way you compute num_samples_traversed. Right now, it will always be equal to 320. You need to accumulate print_freq * batch_size like this:
num_samples_traversed += print_freq * batch_size
or you could use vatriable i to compute it:
num_samples_traversed = (i+1) * batch_size