MACs 和 FLOPs 有什么区别?如何计算?
一、MACs 和 FLOPs 有什么区别?FLOPs is abbreviation of floating operations which includes mul / add / div … etc.MACs stands for multiply–accumulate operation that performs a <- a + (b x c).12二、如何计算?安装thoppi
·
一、MACs 和 FLOPs 有什么区别?
FLOPs is abbreviation of floating operations which includes mul / add / div … etc.
MACs stands for multiply–accumulate operation that performs a <- a + (b x c).12
二、如何计算?
安装thop
pip install thop
pytorch使用thop:3
from torchvision.models import resnet50
from thop import profile
model = resnet50()
input = torch.randn(1, 3, 224, 224)
macs, params = profile(model, inputs=(input, ))
三、MACs 和 FLOPs的关系
FLOPs = 2 * MACs
-
https://github.com/Lyken17/pytorch-OpCounter/tree/master/benchmark#macs-flops-what-is-the-difference ↩︎ ↩︎
-
https://github.com/Lyken17/pytorch-OpCounter/issues/46 ↩︎
-
https://github.com/Lyken17/pytorch-OpCounter ↩︎
-
https://zhuanlan.zhihu.com/p/364543528 ↩︎
-
https://github.com/sovrasov/flops-counter.pytorch/issues/16 ↩︎
更多推荐
所有评论(0)