python统计秒数

code

1.没有cuda的版本

复制代码
import time

s = time.time()
for i in range(100):
	pass
t = time.time()
print("time:{} sec".format(t-s))

2.cuda 同步

复制代码
torch.cuda.synchronize()
start = time.time()
result = model(input)
torch.cuda.synchronize()
end = time.time()

ref

https://blog.csdn.net/qq_36268040/article/details/100085263

相关推荐
CTA终结者12 分钟前
近期AI量化学习,把规则改写接到策略开发
人工智能·python
有Li14 分钟前
使用整合电子健康记录的大语言模型智能体实现前列腺癌患者教育个性化文献速递/医学智能体前沿
人工智能·python·机器学习·语言模型·医学生
米码收割机34 分钟前
【Python】Flask+SQLite_web 宠物领养系统 (源码+文档)【独一无二】
前端·python·flask
卷无止境1 小时前
python进阶:类方法与静态方法的分野,classmethod 和 staticmethod 到底该怎么选
后端·python
卷无止境1 小时前
继承与多态:Python OOP里最容易被用错的两把梯子
后端·python
SelectDB技术团队1 小时前
丰巢日志平台 ELK 替代:Apache Doris / SelectDB 的技术能力与实践
开发语言·python
崖边看雾1 小时前
Python学习——函数
开发语言·windows·python·学习·pycharm
深念Y2 小时前
Windows幽灵端口占用:HNS如何无声偷走你的端口
windows·python·bug·环境·端口·特权
宸津-代码粉碎机2 小时前
Jar热部署进阶实战|修复原生方案OOM与类冲突问题,生产级无BUG优化方案
java·大数据·服务器·开发语言·前端·人工智能·python