THOP: PyTorch-OpCounter
How to install
-
Through PyPi
pip install thop -
Using GitHub (always latest)
pip install --upgrade git+https://github.com/Lyken17/pytorch-OpCounter.git
How to use
-
Basic usage
from torchvision.models import resnet50 from thop import profile model = resnet50() input = torch.randn(1, 3, 224, 224) flops, params = profile(model, inputs=(input, ))
-
Define the rule for 3rd party module.
class YourModule(nn.Module): # your definition def count_your_model(model, x, y): # your rule here input = torch.randn(1, 3, 224, 224) flops, params = profile(model, inputs=(input, ), custom_ops={YourModule: count_your_model})
Results on Recent Models
|
|
Metadata
Release files for thop 0.0.23-1908021457
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| thop-0.0.23-1908021457.tar.gz | 4.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| thop-0.0.23.post1908021457-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.6 kB
Release files / thop-0.0.23-1908021457.tar.gz
| Download URL | thop-0.0.23-1908021457.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3a20dddd777f93d3b1eb810c3af4ff0e6dc6c6f02051e9c7f621e1ced73e0ea0
|
|
BLAKE2b-256 checksum How to use checksums |
f49a29eb75e1bac704024e721ed4b958aea0e424c33bc1c2fd6182d3673d9311
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/39.1.0 requests-toolbelt/0.9.1 tqdm/4.26.0 CPython/3.6.5
|
Release files / thop-0.0.23.post1908021457-py3-none-any.whl
| Download URL | thop-0.0.23.post1908021457-py3-none-any.whl |
|---|---|
| Size | 4.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6beeaaf69843c253c91b27e0c6affb32d7ffd28f4b2184bb191c90a1942778f2
|
|
BLAKE2b-256 checksum How to use checksums |
d40f7b35dc30299b89ac294159e8a8eeb9c0e3247f193cfc84cbc5f62eeafb40
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/39.1.0 requests-toolbelt/0.9.1 tqdm/4.26.0 CPython/3.6.5
|