From 09a60de6bcbede3d4f4d2c435954e939dbcd4d69 Mon Sep 17 00:00:00 2001 From: Xu Ma Date: Tue, 19 Apr 2022 11:37:20 -0400 Subject: [PATCH] Create analysis.py --- analysis.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 analysis.py diff --git a/analysis.py b/analysis.py new file mode 100644 index 0000000..65404d5 --- /dev/null +++ b/analysis.py @@ -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")