Skip to content

Commit

Permalink
Create analysis.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ma-xu committed Apr 19, 2022
1 parent c1d6235 commit 09a60de
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions analysis.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import torch
import fvcore.nn
import fvcore.common
from fvcore.nn import FlopCountAnalysis
from classification_ScanObjectNN.models import pointMLPElite

model = pointMLPElite()
# model = deit_tiny_patch16_224()

inputs = (torch.randn((1,3,1024)),)
k = 1024.0
flops = FlopCountAnalysis(model, inputs).total()
print(f"Flops : {flops}")
flops = flops/(k**3)
print(f"Flops : {flops:.1f}G")
params = fvcore.nn.parameter_count(model)[""]
print(f"Params : {params}")
params = params/(k**2)
print(f"Params : {params:.1f}M")

0 comments on commit 09a60de

Please sign in to comment.