Lyken17/pytorch-OpCounter
Lyken17/pytorch-OpCounter has 5,084 GitHub stars and 538 forks. GitHot measured 0 stars in 24 hours, +1 in 7 days, and -1 in 15 days. Last checked 2026-11-23 03:12 UTC. Last push 2024-07-08.
Progression mesurée des étoiles
- in 24h
- 0
- in 7 days
- +1
- in 15 days
- -1
- in 1 month
- Historique en cours
Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.
À propos
Comptez les MAC/FLOP de votre modèle PyTorch.
Apprentissage automatiqueREADME.md
OriginalTHOP: PyTorch-OpCounter
How to install
pip install thop (now continously intergrated on Github actions)
OR
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) macs, 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) macs, params = profile(model, inputs=(input, ), custom_ops={YourModule: count_your_model})Improve the output readability
Call
thop.clever_formatto give a better format of the output.from thop import clever_format macs, params = clever_format([macs, params], "%.3f")
Results of Recent Models
The implementation are adapted from torchvision. Following results can be obtained using benchmark/evaluate_famous_models.py.
|
|
Explorer des projets similaires
Chargement…