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

相关推荐
ydjs678899-bot3 小时前
如何在Java中打印pdf静默打印和打印对话框选择
java·python·pdf
把我格子衫拿来4 小时前
误差预算怎么做?从雅可比到蒙特卡洛的三维定位不确定度分析
python·蒙特卡洛·三维定位·误差分析·不确定度
文章永久免费只为良心4 小时前
Ctfshow_Web应用安全与防护_第二章_无字母数字命令执行
前端·python·安全·网络安全·渗透测试·ctf·红队渗透测试
2601_962885724 小时前
如何用 Python 获取上证指数、沪深300、中证500 等指数行情?
开发语言·python
昔我往昔4 小时前
LangChain_RAG_学习小结
后端·python
张张123y4 小时前
后端第六课:Python 语法速通(0 基础入门,AI 应用开发的第一门语言)
开发语言·人工智能·python·ai·后端开发
小马不起床4 小时前
Django 后端实战指南_10:用户扩展档案信息表
python·django·sqlite
Want5954 小时前
Python跳动的爱心①
开发语言·python·数学建模
SamChan904 小时前
PDF 翻译后 1,250 变成 1.250,是错了吗?用 Python 核对数字格式
python·pdf·ocr·数据校验·文档翻译
Yolanda_20224 小时前
30.利用GPU训练(一)
python