You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the SimpleConv example given in README it show model has 20 parameters but in reality it only has 10 trainable parameters.
As the self.features is called twice it is double counting the parameters.
In the SimpleConv example given in README it show model has 20 parameters but in reality it only has 10 trainable parameters.
As the self.features is called twice it is double counting the parameters.
Try the following:
print(model)
SimpleConv(
(features): Sequential(
(0): Conv2d(1, 1, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(1): ReLU()
)
)
print(model.features[0].weight.numel(), model.features[0].bias.numel())
9 1
model
`import torch
import torch.nn as nn
from torchsummary import summary
class SimpleConv(nn.Module):
def init(self):
super(SimpleConv, self).init()
self.features = nn.Sequential(
nn.Conv2d(1, 1, kernel_size=3, stride=1, padding=1),
nn.ReLU(),
)
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model = SimpleConv().to(device)
summary(model, [(1, 16, 16), (1, 28, 28)])`
`----------------------------------------------------------------
Layer (type) Output Shape Param #
================================================================
Total params: 20
Trainable params: 20
Non-trainable params: 0
Input size (MB): 0.77
Forward/backward pass size (MB): 0.02
Params size (MB): 0.00
Estimated Total Size (MB): 0.78
----------------------------------------------------------------`
The text was updated successfully, but these errors were encountered: