You will need to create a variable for storing that value. Tensorflow minimizer function has an argument called global_step, which provides the iterations number during training process (it's not necessary to be the epoch).
Variable to increment by one after the variables have been updated.
So here is how you can do that
global_step = tf.Variable(0, name='global_step', trainable=False)
loss = custom_loss(global_step)
optimizer = tf.train.RMSPropOptimizer(learning_rate=1e-4)
minimizer = optimizer.minimize(loss, global_step=global_step)
# global_step will contain number of iterations during training
For more details, you can take a look at the optimizer.minimize() function. Also, there is a global function for it as well tf.train.global_step().