当前位置:网站首页>tqdm的多行显示与单行显示
tqdm的多行显示与单行显示
2022-07-02 07:44:00 【lanmy_dl】
引入
from tqdm import tqdm
pbar = tqdm(total=n_batches)
单行显示
缺点,看不到变化的过程,因为会覆盖掉;优点,节省屏幕,看的舒心
for 循环取数据过程
pbar.set_description('Train loss: %.3f / loss %.3f' % (train_loss / (i + 1), loss.item()))
pbar.update()
pbar.close()
好比

多行显示
不关闭close()就是多行显示
for 循环取数据过程
pbar.set_description('Train loss: %.3f / loss %.3f' % (train_loss / (i + 1), loss.item()))
pbar.update()

补充完整循环
上面的循环就是train里面取每个数据来训练的循环,常用是这样
for i,(img, label) in enumerate(train_loader):
pbar.set_description('Train loss: %.3f / loss %.3f' % (train_loss / (i + 1), loss.item()))
pbar.update()
pbar.close() # 如果单行显示这行没有
边栏推荐
- The first white paper on agile practice in Chinese enterprises was released | complete download is attached
- static 函数中的静态变量
- [play with FPGA learning 5 in simple terms ----- reset design]
- MongoDB 学习整理(条件操作符,$type 操作符,limit()方法,skip() 方法 和 sort() 方法)
- JSP webshell free -- the basis of JSP
- What are the software product management systems? Inventory of 12 best product management tools
- TIPC messaging3
- PCL extracts a subset from a point cloud
- 2022 love analysis · panoramic report of digital manufacturers of state-owned enterprises
- Openmldb meetup No.4 meeting minutes
猜你喜欢
随机推荐
php中self和static在方法中的区别
TIPC Getting Started6
[quick application] win7 system cannot run and debug projects using Huawei ide
JVM之垃圾回收器
二叉树专题--AcWing 47. 二叉树中和为某一值的路径(前序遍历)
二叉树专题--AcWing 18. 重建二叉树(利用前、中序遍历,构建二叉树)
Special topic of binary tree -- Logu p1229 traversal problem (the number of traversals in the middle order is calculated when the pre and post order traversals of the multiplication principle are know
PHP tea sales and shopping online store
JSP webshell free -- webshell free
LVM操作
C# 文件与文件夹操作
【快应用】Win7系统使用华为IDE无法运行和调试项目
华为联机对战服务玩家掉线重连案例总结
MTK full dump抓取
JSP webshell free -- the basis of JSP
Mongodb learning and sorting (condition operator, $type operator, limit() method, skip() method and sort() method)
Is the account above changtou school safe?
Use of vscode tool
[quick application] there are many words in the text component. How to solve the problem that the div style next to it will be stretched
华为游戏初始化init失败,返回错误码907135000








