[Python]使用itertools.count来计数训练
2019-03-31 本文已影响0人
VanJordan
-
itertools.count(start,step)
函数的意思是创建一个从start
开始每次的步长是step
的无穷序列
# At any point you can hit Ctrl + C to break out of training early.
try:
for epoch in itertools.count(start=1):
train()
if train_step == args.max_step:
logging('-' * 100)
logging('End of training')
break
except KeyboardInterrupt:
logging('-' * 100)
logging('Exiting from training early')