forked from Lyken17/pytorch-OpCounter
-
-
Notifications
You must be signed in to change notification settings - Fork 9
Labels
bugSomething isn't workingSomething isn't working
Description
Search before reporting
- I have searched the appropriate Ultralytics issues and found no similar bug report.
Repository or project
https://github.com/ultralytics/thop
Component / area
No response
Bug description
- Got the zero parameters when profile a single layer (e.g. nn.Conv2d)
Environment
- OS: Windows11 24H2
- Python: 3.12.12
- Install: git
Package Version
- filelock: 3.20.0
- fsspec: 2025.12.0
- Jinja2: 3.1.6
- MarkupSafe: 2.1.5
- mpmath: 1.3.0
- networkx: 3.6.1
- numpy: 2.3.5
- packaging: 25.0
- pillow: 12.0.0
- pip: 26.0.1
- setuptools: 80.10.2
- sympy: 1.14.0
- torch: 2.10.0+cu128
- torchvision: 0.25.0+cu128
- typing_extensions: 4.15.0
- wheel: 0.46.3
Minimal reproducible example
from thop import profile
import torch
import torch.nn as nn
class test_model(nn.Module):
def __init__(self):
super().__init__()
self.layer = nn.Conv2d(3, 10, (3,3))
def forward(self, input):
return self.layer(input)
layer = nn.Conv2d(3, 10, (3,3))
model = test_model()
macs, weight = profile(layer, torch.zeros(1,3,224,224))
print("Single Layer Profile Weights: ", weight)
# Single Layer Profile Weights: 0
macs, weight = profile(model, torch.zeros(1,3,224,224))
print("Model Profile Weights: ", weight)
# Model Profile Weights: 280.0Additional context
- In example, the weights of
nn.Conv2d(3, 10, (3,3))should be 280 but got 0
Are you willing to submit a PR?
- Yes, I'd like to help by submitting a PR!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working