Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is the definition of MACs ? #46

Open
minghongli233 opened this issue Sep 24, 2019 · 8 comments
Open

What is the definition of MACs ? #46

minghongli233 opened this issue Sep 24, 2019 · 8 comments

Comments

@minghongli233
Copy link

Hello!
I want to use the code to count the Multi-Adds operations, but I don't know if the Multi-Adds operations and MACs and FLOPs are the same thing.
I'm confused about the definition of MACs and FLOPs, and I'm also not clearly know if the code you provided is to count the MACs or FLOPs .
Could you tell me the definition of them and the difference between them?
Thank you!

@mjjung0925
Copy link

This might help! sovrasov/flops-counter.pytorch#16

@minghongli233
Copy link
Author

Thanks for your supply! It is really helpful.

@xuxy09
Copy link

xuxy09 commented Jan 16, 2020

As far as I can understand, the direct output of the "profile" function is MACs instead of FLOPs. However, the demo code in the readme file uses flops as the name of the output variable. Is this a typo? Thanks.

@haoweiz23
Copy link

As far as I can understand, the direct output of the "profile" function is MACs instead of FLOPs. However, the demo code in the readme file uses flops as the name of the output variable. Is this a typo? Thanks.

the demo code in benchmark/readme is wrong. Macs returned by the "profile" function . If you want get the Flops, you should multiply 2.

@ZhangYuef
Copy link

ZhangYuef commented Jan 26, 2021

I am confused by the FLOPs results in original ResNet paper. Let's take resnet-50 as an example. In ResNet paper the FLOPs value is 3.8G while in this repo we get 4.14G for MACs which means 4.14*2G FLOPs. So can we infer that FLOPs definition is the same here with MACs?

OpCounter
ResNet

@ssgosh
Copy link

ssgosh commented Aug 31, 2021

I am confused by the FLOPs results in original ResNet paper. Let's take resnet-50 as an example. In ResNet paper the FLOPs value is 3.8G while in this repo we get 4.14G for MACs which means 4.14*2G FLOPs. So can we infer that FLOPs definition is the same here with MACs?

OpCounter
ResNet

The original resnet paper reports MACs - see the bottom-right paragraph on page 3: https://arxiv.org/pdf/1512.03385.pdf . Technically a multiply-add is a single floating point operation since 2008 (https://en.wikipedia.org/wiki/IEEE_754-2008_revision), which is probably why they still call it flops. I suppose one could make the distinction as IEEE754-1985 FLOPs vs IEEE754-2008 FLOPs.

image

@Lyken17
Copy link
Owner

Lyken17 commented Sep 1, 2021

I made clarification here https://github.com/Lyken17/pytorch-OpCounter/tree/master/benchmark#macs-flops-what-is-the-difference

@YongyuG
Copy link

YongyuG commented Apr 15, 2022

MACs can also defined as "Memory Access Cost" which is strongly relative to inference time, but I think in this repo is Multi-Add Calculation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants