PyTorch 中的模型分析器
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. Note: This repository is currently under development. Therefore, some APIs might be changed.
This tools can show
There're two ways to install torchstat into your environment.
$ pip install torchstat
$ python3 setup.py install
If you want to run the torchstat asap, you can call it as a CLI tool if your network exists in a script. Otherwise you need to import torchstat as a module.
…
If you're not sure how to use a specific command, run the command with the -h or –help switches. You'll see usage information and a list of options you can use with the command.
from torchstat import stat
import torchvision.models as models
model = models.resnet18()
stat(model, (3, 224, 224))
Note: These features work only nn.Module. Modules in torch.nn.functional are not supported yet.
For the supported layers, check out the details.
Thanks to @sovrasov for the initial version of flops computation, @ceykmc for the backbone of scripts.
暂无开放 Issues,或尚未同步最近议题。