in fvcore/nn/print_model_statistics.py [0:0]
def fill(indent_lvl: int, prefix: str) -> None:
if indent_lvl > max_depth:
return
for mod_name in statistics:
# 'if mod' excludes root = '', which is never a child
if (
mod_name
and mod_name.count(".") == prefix.count(".")
and mod_name.startswith(prefix)
):
mod_name, curr_stats = _fastforward(mod_name, statistics)
if root_prefix and mod_name.startswith(root_prefix):
# Skip the root_prefix shared by all submodules as it carries 0 information
pretty_mod_name = mod_name[len(root_prefix) :]
else:
pretty_mod_name = mod_name
row = build_row(pretty_mod_name, curr_stats, indent_lvl)
table.append(row)
fill(indent_lvl + 1, mod_name + ".")