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

How to calculate FLOPS? #6

Open
albert-666 opened this issue Sep 11, 2020 · 4 comments
Open

How to calculate FLOPS? #6

albert-666 opened this issue Sep 11, 2020 · 4 comments

Comments

@albert-666
Copy link

In the version of global threshold, how to calculate the flops? Is there an example code to calculate the theoretical FLOPS?

@hellozhuo
Copy link
Owner

In the version of global threshold, how to calculate the flops? Is there an example code to calculate the theoretical FLOPS?

Hi, to calculate the actual flops when using global threshold, we need to run the model over the whole testing set (here we refer to the validation set), and track the everage pruning rate in each layer. Because for each layer, the actual pruning rate in different iterations (i.e., within different minibatchs) can also be different.

Once we get the actual pruning rate for each layer, the calculation of flops is similar to the way as using the head-wise threshold.

@albert-666
Copy link
Author

Thanks for your nice answer. Is there any demo code for calculating FLOPS when using global threshold?

@hellozhuo
Copy link
Owner

Once we got the pruning rate for each layer, the calculation of flops can refer to utils.py, by changing the target_pruning_rate to the actual pruning rate we got. The difference is that we have to calculate each layer's flops by using different pruning rates.

image

@albert-666
Copy link
Author

Get it! Thanks!

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

2 participants