Lyken17 / pytorch-OpCounter

Count the MACs / FLOPs of your PyTorch model.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How do I calculate the FLOPs of a model with some frozen layers during training?

js-lee-AI opened this issue · comments

Thank you so much for sharing the code.

As far as I know, frozen layers have no effect on FLOPs in the forward pass. That is, even if frozen layers are included, FLOPs is only affected by the total number of parameters.

So, how do estimate the FLOPs in the backward pass when there are some frozen layers im the model? Is it correct to simply calculate 2 * forward_FLOPs?

I wonder if this code reflects my question.
If not, can someone please help me?

Hi, have you figured it out ?