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

相关推荐
极光代码工作室10 小时前
基于机器学习的二手商品价格预测系统
人工智能·python·深度学习·机器学习
无情的西瓜皮10 小时前
MCP协议实战:从零搭建一个AI Agent工具服务器
运维·服务器·python
IT策士11 小时前
Django 从 0 到 1 打造完整电商平台:系列总结 + 项目演示与后续扩展
后端·python·django
君为先-bey11 小时前
LeMiCa——基于扩散模型的高效视频生成的词典序最小化路径缓存
python·算法·机器学习·扩散模型
L_cl11 小时前
大模型应用开发 9.FastAPI ① 请求与响应
python·fastapi
treesforest12 小时前
机房IP是什么?有什么危害?如何识别?
网络·数据库·python·网络协议·tcp/ip·网络安全
咕白m62512 小时前
Excel 工作表名称读取(Python 实现)
后端·python
godspeed_lucip13 小时前
LLM和Agent——专题5: LLM Ops 入门(1)
人工智能·python
l1t13 小时前
DeepSeek总结的使用实体-组件-系统和基于存在性处理进行Python编程7-8
开发语言·python
俊哥工具13 小时前
无广告免费壁纸工具,手机电脑壁纸随心更换
python·智能手机·django·计算机外设·virtualenv·pygame