进度条模块tqdm的使用

用法1:

代码:

from tqdm import tqdm
import time
for i in tqdm(range(100)):
    time.sleep(0.01)

结果:

在这里插入图片描述

用法2

代码:

from tqdm import trange
epoch = 10
n_batches = 10000
with tqdm(total=n_batches, desc='Train epoch %d' % epoch) as train_enum:
    for batch_num in range(n_batches):
        batch_loss = 3.25

        train_enum.set_description(f'Train (loss: {batch_loss:.2f}) epoch {epoch}')
        train_enum.update()

    
    

结果:

在这里插入图片描述

参考链接

python的Tqdm模块
https://github.com/tqdm/tqdm/tree/master/examples

https://pypi.python.org/pypi/tqdm

https://github.com/tqdm/tqdm

你可能感兴趣的:(深度学习,python,机器学习,github)