简介:
FLOPs : FLOATING-POINT OPERATIONS PER SECOND
1、Pytorch:
pytorch有PyTorch-OpCounter:
github: https://github.com/Lyken17/pytorch-OpCounter
安装:pip install thop
from torchvision.models import resnet18
from thop import profile
import torch
model = resnet18()
input = torch.randn(1, 3, 224, 224)
flops, params = profile(model, inputs=(input, ))
print(flops)