mirror of
https://github.com/wassname/torchsummaryX.git
synced 2026-06-27 16:32:27 +08:00
ignore parameters with no gradient
Is this the right approach?, perhaps it would be better to show trainable vs nontrainable parameters. Or sill use nontrainable parameters to estimate macs
This commit is contained in:
@@ -34,7 +34,7 @@ def summary(model, x, *args, **kwargs):
|
||||
info["inner"] = OrderedDict()
|
||||
info["params"], info["macs"] = 0, 0
|
||||
for name, param in module.named_parameters():
|
||||
info["params"] += param.nelement()
|
||||
info["params"] += param.nelement() * param.requires_grad
|
||||
|
||||
if name == "weight":
|
||||
ksize = list(param.size())
|
||||
|
||||
Reference in New Issue
Block a user