From 87fa9ede4da57e1882ccf2e880f7ba99ea290c42 Mon Sep 17 00:00:00 2001 From: Mike Clark Date: Sun, 7 Jul 2019 02:11:36 +0000 Subject: [PATCH] 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 --- torchsummaryX/torchsummaryX.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/torchsummaryX/torchsummaryX.py b/torchsummaryX/torchsummaryX.py index 29bad77..5870598 100644 --- a/torchsummaryX/torchsummaryX.py +++ b/torchsummaryX/torchsummaryX.py @@ -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())