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

相关推荐
mit6.82420 分钟前
[Agent开发平台] 后端的后端 | MySQL | Redis | RQ | idgen | ObjectStorage
人工智能·python
学编程的小虎27 分钟前
用 Python + Vue3 打造超炫酷音乐播放器:网易云歌单爬取 + Three.js 波形可视化
开发语言·javascript·python
yunson_Liu36 分钟前
编写Python脚本在域名过期10天内将域名信息发送到钉钉
开发语言·python·钉钉
布林模型1 小时前
缠论工具czsc快速使用入门(二)
python·缠论·快速入门·czsc
邂逅you2 小时前
用python操作mysql之pymysql库基本操作
数据库·python·mysql
啊森要自信2 小时前
【GUI自动化测试】YAML 配置文件应用:从语法解析到 Python 读写
android·python·缓存·pytest·pip·dash
合作小小程序员小小店2 小时前
web开发,学院培养计划系统,基于Python,FlaskWeb,Mysql数据库
后端·python·mysql·django·web app
渣渣盟2 小时前
解密NLP:从入门到精通
人工智能·python·nlp
老程序员刘飞2 小时前
注册 区块链节点
python
KAIWEILIUCC2 小时前
Python抽象基类(abc.ABC)介绍
python