FLOPS & FLOPs & MACs


FLOPS & FLOPs & MACs

參考鏈接:
https://www.zhihu.com/question/65305385
https://zhuanlan.zhihu.com/p/144938518
https://zhuanlan.zhihu.com/p/137719986
https://zhuanlan.zhihu.com/p/364543528

FLOPS:

FLOPS (Floating Point Operations Per Second):每秒浮點運算次數,是一個衡量硬件速度的指標。

FLOPs:

FLOPs(Floating Point Operations):浮點運算次數,用來衡量模型計算復雜度,常用來做神經網絡模型速度的間接衡量標准。FLOPSFLOPs常常被人們混淆使用。

MACs:

MACs (Multiply–Accumulate Operations): 乘加累積操作數,常常被人們與FLOPs概念混淆實際上1 MACs 包含一個乘法操作與一個加法操作,大約包含2 FLOPs。通常 MACs 與 FLOPs 存在一個2倍的關系。

Tools:

THOPhttps://github.com/Lyken17/pytorch-OpCounter

示例如下:

import torch
import thop
import torchvision

m = torch.nn.Conv2d(128, 128, 1)
x = torch.randn(1, 128, 16, 16)

macs = thop.profile(m, inputs=(x,), verbose=True)
fprint(macs)


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM