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

相关推荐
Eward-an几秒前
LeetCode 239. 滑动窗口最大值(详细技术解析)
python·算法·leetcode
喵手44 分钟前
Python爬虫实战:用代码守护地球,追踪WWF濒危物种保护动态!
爬虫·python·爬虫实战·濒危物种·零基础python爬虫教学·wwf·濒危物种保护动态追踪
梦想的旅途21 小时前
如何通过 QiWe API 实现企业微信主动发消息
开发语言·python
喵手1 小时前
Python爬虫实战:自动化抓取 Pinterest 热门趋势与创意!
爬虫·python·爬虫实战·pinterest·零基础python爬虫教学·采集pinterest热门趋势·热门趋势预测
凌晨一点的秃头猪1 小时前
Python文件操作
开发语言·python
小张贼嚣张1 小时前
数据分析全流程实战:Python(Pandas/Matplotlib/Numpy)+ MySQL(附可下载数据源+多图形绘制)
python·数据分析·pandas
努力的小白o(^▽^)o1 小时前
面向课堂考勤场景的桌面端人脸识别签到系统
python·人脸识别
sa100272 小时前
淘宝商品详情 API 接口开发实战:item_detail 调用、参数与 Python 示例
linux·数据库·python
Dapenson3 小时前
腾讯小龙虾WorkBuddy技能与插件深度解析
python·ai
无心水3 小时前
【常见错误】2、Java并发编程避坑指南:从加锁失效到死锁,10个案例教你正确使用锁
java·开发语言·python