当前位置:网站首页>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() # 如果单行显示这行没有
边栏推荐
- 华为游戏初始化init失败,返回错误码907135000
- [play with FPGA learning 4 in simple terms ----- talk about state machine design]
- Jenkins安装
- 二叉树专题--AcWing 19. 二叉树的下一个节点(找树中节点的后继)
- 一.STM32的开发环境,keil5/MDK5.14安装教程(附下载链接)
- C#中索引器
- 洛谷 P3398 仓鼠找 sugar(树上倍增 lca 判断树中两条路径是否相交 结论)
- Primary key policy problem
- The difference between self and static in PHP in methods
- C# 文件与文件夹操作
猜你喜欢
如何使用IDE自动签名调试鸿蒙应用
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)
【深入浅出玩转FPGA学习2----设计技巧(基本语法)】
Win11 arm system configuration Net core environment variable
[play with FPGA learning 5 in simple terms ----- reset design]
华为AppLinking中统一链接的创建和使用
华为游戏初始化init失败,返回错误码907135000
实验电镜距离测量之Matlab处理
二叉树专题--AcWing 3540. 二叉搜索树建树(实用板子 构建二叉搜索树 并输出前、中、后序遍历)
Matlab processing of distance measurement of experimental electron microscope
随机推荐
Iii. Système de démarrage et d'horloge à puce
Filtering of PCL
TIPC introduction 1
JSP webshell免殺——JSP的基礎
华为联机对战服务玩家掉线重连案例总结
PCL eigen introduction and simple use
Luogu p5536 [xr-3] core city (greed + tree DP looking for the center of the tree)
Flink two Open, implement Batch Lookup join (attached source)
sql left join 主表限制条件写在on后面和写在where后面的区别
洛谷 P5536 【XR-3】核心城市(贪心 + 树形 dp 寻找树的中心)
Matlab processing of distance measurement of experimental electron microscope
[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
TIPC介绍1
Summary of cases of players' disconnection and reconnection in Huawei online battle service
Overview of integrated learning
AppGallery Connect场景化开发实战—图片存储分享
金山云——2023届暑期实习
[quick application] win7 system cannot run and debug projects using Huawei ide
一招快速实现自定义快应用titlebar
Resources读取2d纹理 转换为png格式