当前位置:网站首页>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() # 如果单行显示这行没有
边栏推荐
- 二叉树专题--AcWing 18. 重建二叉树(利用前、中序遍历,构建二叉树)
- 华为联机对战服务玩家掉线重连案例总结
- LVM操作
- PCL projection point cloud
- K-d tree and octree of PCL
- 使用华为性能管理服务,按需配置采样率
- [AGC] how to solve the problem that the local display of event analysis data is inconsistent with that in AGC panel?
- Openmldb meetup No.4 meeting minutes
- TIPC Service and Topology Tracking4
- Is bond fund safe? Does the bond buying foundation lose principal?
猜你喜欢
全网显示 IP 归属地,是怎么实现的?
Special topic of binary tree -- acwing 3540 Binary search tree building (use the board to build a binary search tree and output the pre -, middle -, and post sequence traversal)
flink二開,實現了個 batch lookup join(附源碼)
TIPC 寻址2
Matlab processing of distance measurement of experimental electron microscope
TIPC addressing 2
Use of vscode tool
JVM之垃圾回收器
[play with FPGA learning 2 in simple terms ----- design skills (basic grammar)]
Mongodb learning and sorting (condition operator, $type operator, limit() method, skip() method and sort() method)
随机推荐
sqlite 修改列类型
华为快应用中如何实现同时传递事件对象和自定义参数
高德根据轨迹画线
Logu p3398 hamster looks for sugar (double LCA on the tree to judge whether the two paths in the tree intersect)
2022-06-17
三.芯片啟動和時鐘系統
TIPC 寻址2
Luogu p5536 [xr-3] core city (greed + tree DP looking for the center of the tree)
二叉树专题--洛谷 P3884 [JLOI2009]二叉树问题(dfs求二叉树深度 bfs求二叉树宽度 dijkstra求最短路)
Is bond fund safe? Does the bond buying foundation lose principal?
二叉树专题--AcWing 19. 二叉树的下一个节点(找树中节点的后继)
TIPC Service and Topology Tracking4
Oracle notes
How does the whole network display IP ownership?
二叉树专题--P1030 [NOIP2001 普及组] 求先序排列
LabVIEW为什么浮点数会丢失精度
Mongodb learning and sorting (condition operator, $type operator, limit() method, skip() method and sort() method)
PHP tea sales and shopping online store
二叉树专题--AcWing 18. 重建二叉树(利用前、中序遍历,构建二叉树)
[in simple terms, play with FPGA learning 3 ----- basic grammar]