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

相关推荐
芝士爱知识a7 分钟前
2026年 AI 期权工具全维度测评与推荐榜单:AlphaGBM 领跑,量化交易新范式
大数据·人工智能·python·ai量化·alphagbm·ai期权工具·ai期权工具推荐
天远Date Lab8 分钟前
天远入职背调报告API对接实战:Python构建自动化背景调查中台
大数据·网络·python·自动化
一叶萩Charles9 分钟前
MCP 实战:国家统计局数据查询 Server 从开发到发布
javascript·人工智能·python·node.js
chushiyunen16 分钟前
python双下划线魔术方法(特殊方法)(双下划线方法)
python
米码收割机19 分钟前
【AI】OpenClaw问题排查
开发语言·数据库·c++·python
所谓伊人,在水一方33320 分钟前
【Python数据科学实战之路】第10章 | 机器学习基础:从理论到实践的完整入门
开发语言·人工智能·python·机器学习·matplotlib
王夏奇21 分钟前
Python-对excel文件操作-pandas库
python·excel·pandas
无风听海21 分钟前
Python之TypeVar深入解析
开发语言·python·typevar
独断万古他化22 分钟前
Python 接口测试之 requests 库核心用法
python·pytest·接口测试·requests
E_ICEBLUE25 分钟前
Excel 删除空白行的 5 种方法 【手动管理与 Python 自动化】
python·自动化·excel