The calflops is designed to calculate FLOPs、MACs and Parameters in all various neural networks, such as Linear、 CNN、 RNN、 GCN、Transformer(Bert、LlaMA etc Large Language Model)
But the results (FLOPS, MACs) I got didn't match the results described in your README.
------------------------------------- Calculate Flops Results -------------------------------------
Notations:
number of parameters (Params), number of multiply-accumulate operations(MACs),
number of floating-point operations (FLOPs), floating-point operations per second (FLOPS),
fwd FLOPs (model forward propagation FLOPs), bwd FLOPs (model backward propagation FLOPs),
default model backpropagation takes 2.00 times as much computation as forward propagation.
Total Training Params: 61.1 M
fwd MACs: 714.188 MMACs
fwd FLOPs: 1.4297 GFLOPS
fwd+bwd MACs: 2.1426 GMACs
fwd+bwd FLOPs: 4.2892 GFLOPS
-------------------------------- Detailed Calculated FLOPs Results --------------------------------
Each module caculated is listed after its name in the following order:
params, percentage of total params, MACs, percentage of total MACs, FLOPS, percentage of total FLOPs
Note: 1. A module can have torch.nn.module or torch.nn.functional to compute logits (e.g. CrossEntropyLoss).
They are not counted as submodules in calflops and not to be printed out. However they make up the difference between a parent's MACs and the sum of its submodules'.
2. Number of floating-point operations is a theoretical estimation, thus FLOPS computed using that could be larger than the maximum system throughput.
AlexNet(
61.1 M = 100% Params, 714.19 MMACs = 100% MACs, 1.43 GFLOPS = 100% FLOPs
(features): Sequential(
...
)
---------------------------------------------------------------------------------------------------
Alexnet FLOPs:1.4297 GFLOPS MACs:714.188 MMACs Params:61.1008 M
Your README shows Alexnet FLOPs:4.2892 GFLOPS MACs:2.1426 GMACs Params:61.1008 M
I think this may be a typo by the author of the Readme document. In his subsequent calculation screenshots and results, the results are the same as yours.
I ran the example code exactly as the same as provided.
But the results (FLOPS, MACs) I got didn't match the results described in your README.
Your README shows
Alexnet FLOPs:4.2892 GFLOPS MACs:2.1426 GMACs Params:61.1008 M