You should see how authors use the outer loop - likely they do some periodic actions, and decided to change epoch numeration for that (e.g. there are validation epochs every 10 training epochs, and num_epochs counts the former). Not very good idea overall, IMHO.