{ "info": { "author": "Swall0w", "author_email": "", "bugtrack_url": null, "classifiers": [], "description": "[![Build Status](https://travis-ci.org/Swall0w/torchstat.svg?branch=master)](https://travis-ci.org/Swall0w/torchstat)\n\n# torchstat\nThis is a lightweight neural network analyzer based on PyTorch.\nIt is designed to make building your networks quick and easy, with the ability to debug them.\n**Note**: This repository is currently under development. Therefore, some APIs might be changed.\n\nThis tools can show\n\n* Total number of network parameters\n* Theoretical amount of floating point arithmetics (FLOPs)\n* Theoretical amount of multiply-adds (MAdd)\n* Memory usage\n\n## Installing\nThere're two ways to install torchstat into your environment.\n* Install it via pip.\n```bash\n$ pip install torchstat\n```\n\n* Install and update using **setup.py** after cloning this repository.\n```bash\n$ python3 setup.py install\n```\n\n## A Simple Example\nIf you want to run the torchstat asap, you can call it as a CLI tool if your network exists in a script.\nOtherwise you need to import torchstat as a module.\n\n### CLI tool\n```bash\n$ torchstat masato$ torchstat -f example.py -m Net\n[MAdd]: Dropout2d is not supported!\n[Flops]: Dropout2d is not supported!\n[Memory]: Dropout2d is not supported!\n module name input shape output shape params memory(MB) MAdd Flops MemRead(B) MemWrite(B) duration[%] MemR+W(B)\n0 conv1 3 224 224 10 220 220 760.0 1.85 72,600,000.0 36,784,000.0 605152.0 1936000.0 57.49% 2541152.0\n1 conv2 10 110 110 20 106 106 5020.0 0.86 112,360,000.0 56,404,720.0 504080.0 898880.0 26.62% 1402960.0\n2 conv2_drop 20 106 106 20 106 106 0.0 0.86 0.0 0.0 0.0 0.0 4.09% 0.0\n3 fc1 56180 50 2809050.0 0.00 5,617,950.0 2,809,000.0 11460920.0 200.0 11.58% 11461120.0\n4 fc2 50 10 510.0 0.00 990.0 500.0 2240.0 40.0 0.22% 2280.0\ntotal 2815340.0 3.56 190,578,940.0 95,998,220.0 2240.0 40.0 100.00% 15407512.0\n===============================================================================================================================================\nTotal params: 2,815,340\n-----------------------------------------------------------------------------------------------------------------------------------------------\nTotal memory: 3.56MB\nTotal MAdd: 190.58MMAdd\nTotal Flops: 96.0MFlops\nTotal MemR+W: 14.69MB\n```\n\nIf you're not sure how to use a specific command, run the command with the -h or \u2013help switches.\nYou'll see usage information and a list of options you can use with the command.\n\n### Module\n```python\nfrom torchstat import stat\nimport torchvision.models as models\n\nmodel = models.resnet18()\nstat(model, (3, 224, 224))\n```\n\n## Features & TODO\n**Note**: These features work only nn.Module. Modules in torch.nn.functional are not supported yet.\n- [x] FLOPs\n- [x] Number of Parameters\n- [x] Total memory\n- [x] Madd(FMA)\n- [x] MemRead\n- [x] MemWrite\n- [ ] Model summary(detail, layer-wise)\n- [ ] Export score table\n- [ ] Arbitrary input shape\n\nFor the supported layers, check out [the details](./detail.md).\n\n\n## Requirements\n* Python 3.6+\n* Pytorch 0.4.0+\n* Pandas 0.23.4+\n* NumPy 1.14.3+\n\n## References\nThanks to @sovrasov for the initial version of flops computation, @ceykmc for the backbone of scripts.\n* [flops-counter.pytorch](https://github.com/sovrasov/flops-counter.pytorch)\n* [pytorch_model_summary](https://github.com/ceykmc/pytorch_model_summary)\n* [chainer_computational_cost](https://github.com/belltailjp/chainer_computational_cost)\n* [convnet-burden](https://github.com/albanie/convnet-burden).\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Swall0w/torchstat", "keywords": "", "license": "Type license() to see the full license text", "maintainer": "", "maintainer_email": "", "name": "torchstat", "package_url": "https://pypi.org/project/torchstat/", "platform": "", "project_url": "https://pypi.org/project/torchstat/", "project_urls": { "Homepage": "https://github.com/Swall0w/torchstat" }, "release_url": "https://pypi.org/project/torchstat/0.0.7/", "requires_dist": [ "torch", "numpy", "pandas" ], "requires_python": "", "summary": "torchstat: The Pytorch Model Analyzer.", "version": "0.0.7" }, "last_serial": 4444349, "releases": { "0.0.5": [ { "comment_text": "", "digests": { "md5": "d909a0c554b9d9d75fbdc6a429782988", "sha256": "a0a09d5ad4c9285b6920876254a8cdc93f565b82f13aac94527b7aef2de74be6" }, "downloads": -1, "filename": "torchstat-0.0.5-py3.6.egg", "has_sig": false, "md5_digest": "d909a0c554b9d9d75fbdc6a429782988", "packagetype": "bdist_egg", "python_version": "3.6", "requires_python": null, "size": 22240, "upload_time": "2018-10-28T00:54:04", "url": "https://files.pythonhosted.org/packages/fb/32/3d04918cf41703d9ff2e8e2c7228dacb77fb6fb5312d983b93f9255a0c11/torchstat-0.0.5-py3.6.egg" }, { "comment_text": "", "digests": { "md5": "7e959fd22e1c27a99e95419f18f5fa2a", "sha256": "c33e442c78e6c41016d6bda0c1e00c71177746eb808d5d861a8f8b417c8a376a" }, "downloads": -1, "filename": "torchstat-0.0.5-py3-none-any.whl", "has_sig": false, "md5_digest": "7e959fd22e1c27a99e95419f18f5fa2a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10238, "upload_time": "2018-10-28T00:54:02", "url": "https://files.pythonhosted.org/packages/23/92/3de1c565506aa63789f77cfcfc122626279ae74eac57fe053f1b4390fe24/torchstat-0.0.5-py3-none-any.whl" } ], "0.0.6": [ { "comment_text": "", "digests": { "md5": "bd8d5b94431dc7ac87e4484c35d2060d", "sha256": "2f0851154bbdb25c32f261a02d38a78475113589b197ee16fbc1235178f74437" }, "downloads": -1, "filename": "torchstat-0.0.6-py3-none-any.whl", "has_sig": false, "md5_digest": "bd8d5b94431dc7ac87e4484c35d2060d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10336, "upload_time": "2018-10-31T14:12:50", "url": "https://files.pythonhosted.org/packages/42/d0/2ee9f9a4c1ecb1c59a5a676779d40b326931cbfd9851de5744f8a50da13d/torchstat-0.0.6-py3-none-any.whl" } ], "0.0.7": [ { "comment_text": "", "digests": { "md5": "587d4739c0583cfc66fb483ec5752c51", "sha256": "b2b55fac368b494b86cdd3c298a5d8c5de7908bd3404a8df909c0824defef330" }, "downloads": -1, "filename": "torchstat-0.0.7-py3-none-any.whl", "has_sig": false, "md5_digest": "587d4739c0583cfc66fb483ec5752c51", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 11626, "upload_time": "2018-11-02T12:00:23", "url": "https://files.pythonhosted.org/packages/bc/fe/f483b907ca80c90f189cd892bb2ce7b2c256010b30314bbec4fc17d1b5f1/torchstat-0.0.7-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "587d4739c0583cfc66fb483ec5752c51", "sha256": "b2b55fac368b494b86cdd3c298a5d8c5de7908bd3404a8df909c0824defef330" }, "downloads": -1, "filename": "torchstat-0.0.7-py3-none-any.whl", "has_sig": false, "md5_digest": "587d4739c0583cfc66fb483ec5752c51", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 11626, "upload_time": "2018-11-02T12:00:23", "url": "https://files.pythonhosted.org/packages/bc/fe/f483b907ca80c90f189cd892bb2ce7b2c256010b30314bbec4fc17d1b5f1/torchstat-0.0.7-py3-none-any.whl" } ] }