训练模型的剩余时间

训练模型的剩余时间
 1 import time
 2 import datetime
 3 prev_time = time.time() #epoch循环之外
 4 # epoch训练循环之内
 5         batches_done = (epoch - start_iter + 1) * len(data_loader) + _ + 1
 6         batches_left = (args.train_epochs + 2 - start_iter) * len(data_loader) - batches_done
 7         time_left = datetime.timedelta(seconds=batches_left * (time.time() - prev_time))
 8         prev_time = time.time()
 9 print('[Epoch %d/%d] [Batch %d/%d] [count %d] [G_loss %f] [time %s] ' %
10               (epoch, args.train_epochs, _ + 1, len(data_loader), count, G_loss, time_left))
View Code

 

上一篇:双向带头循环链表


下一篇:4.链表和递归