未验证 提交 0ad08608 编写于 作者: C Cheng Li 提交者: GitHub

remove require grad in params count (#2065)

Co-authored-by: NOlatunji Ruwase <olruwase@microsoft.com>
上级 50a652e7
......@@ -148,8 +148,7 @@ class FlopsProfiler(object):
def add_or_reset_attrs(module):
module.__flops__ = 0
module.__macs__ = 0
module.__params__ = sum(p.numel() for p in module.parameters()
if p.requires_grad)
module.__params__ = sum(p.numel() for p in module.parameters())
module.__start_time__ = 0
module.__duration__ = 0
......@@ -339,7 +338,7 @@ class FlopsProfiler(object):
macs = get_module_macs(module)
items = [
params_to_string(params),
"{:.2%} Params".format(params / total_params),
"{:.2%} Params".format(params / total_params if total_params else 0),
macs_to_string(macs),
"{:.2%} MACs".format(0.0 if total_macs == 0 else macs / total_macs),
]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册