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:
Mike Clark
2019-07-07 02:11:36 +00:00
committed by GitHub
parent 6a722e9afd
commit 87fa9ede4d
+1 -1
View File
@@ -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())