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

fix flops (#29818)

上级 01c37c8e
...@@ -255,7 +255,8 @@ def dynamic_flops(model, inputs, custom_ops=None, print_detail=False): ...@@ -255,7 +255,8 @@ def dynamic_flops(model, inputs, custom_ops=None, print_detail=False):
for m in model.sublayers(): for m in model.sublayers():
if len(list(m.children())) > 0: if len(list(m.children())) > 0:
continue continue
if hasattr(m, 'total_ops') and hasattr(m, 'total_params'): if set(['total_ops', 'total_params', 'input_shape',
'output_shape']).issubset(set(list(m._buffers.keys()))):
total_ops += m.total_ops total_ops += m.total_ops
total_params += m.total_params total_params += m.total_params
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册