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的关系
粗略的:4,1,5
MACs = 2 * FLOPs
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 ↩︎



