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

相关推荐
小北方城市网21 小时前
SpringBoot 集成 Redis 实战(缓存与分布式锁):提升系统性能与并发能力
spring boot·python·rabbitmq·java-rabbitmq·数据库架构
Pyeako21 小时前
opencv计算机视觉--传参方法&银行卡识别&身份证识别案例
人工智能·python·opencv·计算机视觉·身份证识别·银行卡识别·传参方法
夔曦21 小时前
【无标题】
python·强化学习算法
先做个垃圾出来………21 小时前
Python 中 kwargs.get() 方法详解
开发语言·python
大闲在人21 小时前
Trae builder 实战: 让 C++ 函数像 Python 一样返回多个值
c++·python·ai编程
柠檬丶抒情1 天前
Rust深度学习框架Burn 0.20是否能超过python?
python·深度学习·rust·vllm
reesn1 天前
celery 使用说明
python
ValhallaCoder1 天前
Day50-图论
数据结构·python·算法·图论
好好学操作系统1 天前
notion+excel自动创建表格| 了解了notion api
数据库·python·oracle·excel·notion
一晌小贪欢1 天前
用 PyQt5 做一个「批量目录重命名」工具,并打包成带图标的 EXE
开发语言·驱动开发·python·python基础·python小白