프로젝트
GitHub에서 보기
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.
측정된 스타 증가
- in 24h
- 0
- in 7 days
- +1
- in 15 days
- -1
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
소개
PyTorch 모델의 MAC 수와 FLOP 수를 계산합니다.
머신러닝README.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.
|
|
관련 프로젝트 살펴보기
불러오는 중…