首页 > 其他分享 >tqdm在jupyter和pycharm中的不同用法

tqdm在jupyter和pycharm中的不同用法

时间:2022-12-06 15:45:23浏览次数:39  
标签:tqdm set jupyter loader epoch sleep pycharm loop

1. jupyter 

from time import sleep
from tqdm.notebook import tqdm
for epoch in range(1, CFG.epoch + 1):
    loop = tqdm((train_loader), total = len(train_loader))
    for x in loop:
#         x_, y_ = x[0].reshape(-1, 784), x[1]
        loop.set_description(f'Epoch [{epoch}/{CFG.epoch}]')
        loop.set_postfix(loss = 1,acc = f'{123}')
        sleep(0.01)

2.pycharm

from time import sleep
from tqdm import tqdm 
for epoch in range(1, CFG.epoch + 1):
    loop = tqdm((train_loader), total = len(train_loader))
    for x in loop:
#         x_, y_ = x[0].reshape(-1, 784), x[1]
        loop.set_description(f'Epoch [{epoch}/{CFG.epoch}]')
        loop.set_postfix(loss = 1,acc = f'{123}')
        sleep(0.01)

  

标签:tqdm,set,jupyter,loader,epoch,sleep,pycharm,loop
From: https://www.cnblogs.com/ygxdbmx/p/16955467.html

相关文章