From e5b14d4b39cc1884b3c4fb70bbdb4dc310a6d12a Mon Sep 17 00:00:00 2001 From: Andre Anjos <andre.dos.anjos@gmail.com> Date: Mon, 30 Jan 2023 11:20:33 +0100 Subject: [PATCH] [utils.summary] Fix docformatting with small hack --- src/ptbench/utils/summary.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ptbench/utils/summary.py b/src/ptbench/utils/summary.py index a9ff6631..9b815645 100644 --- a/src/ptbench/utils/summary.py +++ b/src/ptbench/utils/summary.py @@ -27,8 +27,8 @@ def summary(model): nparam : int number of parameters """ - - def repr(model): + # ignore this space! + def _repr(model): # We treat the extra repr like the sub-module, one item per line extra_lines = [] extra_repr = model.extra_repr() @@ -38,13 +38,13 @@ def summary(model): child_lines = [] total_params = 0 for key, module in model._modules.items(): - mod_str, num_params = repr(module) + mod_str, num_params = _repr(module) mod_str = _addindent(mod_str, 2) child_lines.append("(" + key + "): " + mod_str) total_params += num_params lines = extra_lines + child_lines - for name, p in model._parameters.items(): + for _, p in model._parameters.items(): if hasattr(p, "dtype"): total_params += reduce(lambda x, y: x * y, p.shape) @@ -60,4 +60,4 @@ def summary(model): main_str += f", {total_params:,} params" return main_str, total_params - return repr(model) + return _repr(model) -- GitLab