Pytorch
torchstat
torchstat: The Pytorch Model Analyzer
This is a lightweight neural network analyzer based on Pytorch. It is designed to make building your networks quick and easy, with the ability to debug them.
This tools can show:
- Total number of network parameters
- Theoretical amount of floating point arithmetics (FLOPs)
- Theoretical amount of multiply-adds (MAdd)
- Memory usage
pip install torchstat
from torchstat import stat
import torchvision.models as models
model = models.resnet18()
stat(model, (3, 224, 224))
Thop
pip install thop
from torchvision.models import resnet50
from thop import profile
model = resnet50()
input = torch.randn(1, 3, 224, 224)
macs, params = profile(model, inputs=(input, ))