未验证 提交 ee1a7d02 编写于 作者: Y yukavio 提交者: GitHub

add some feature for paddle.flops (#29572)

上级 467c7169
...@@ -229,7 +229,7 @@ def dynamic_flops(model, inputs, custom_ops=None, print_detail=False): ...@@ -229,7 +229,7 @@ def dynamic_flops(model, inputs, custom_ops=None, print_detail=False):
else: else:
if m_type not in types_collection: if m_type not in types_collection:
print( print(
"Cannot find suitable count function for {}. Treat it as zero Macs.". "Cannot find suitable count function for {}. Treat it as zero FLOPs.".
format(m_type)) format(m_type))
if flops_fn is not None: if flops_fn is not None:
...@@ -256,9 +256,9 @@ def dynamic_flops(model, inputs, custom_ops=None, print_detail=False): ...@@ -256,9 +256,9 @@ def dynamic_flops(model, inputs, custom_ops=None, print_detail=False):
continue continue
total_ops += m.total_ops total_ops += m.total_ops
total_params += m.total_params total_params += m.total_params
if hasattr(m, 'total_ops') and hasattr(m, 'total_params'):
total_ops = int(total_ops) total_ops = int(total_ops)
total_params = int(total_params) total_params = int(total_params)
if training: if training:
model.train() model.train()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册