code: def _walk_modules(module, name: str = "", path=()):
      # Walk through a PyTorch model and output trace tuples (its path, leafe
      # node, model).
      if not name:
          name = module.__class__.__name__
  
      # This will track the children of the module (layers)
      # for instance, [('conv1', GCNConv(10, 16)), ('conv2', GCNConv(16, 3))]
      named_children = list(module.named_children())
  
      # it builds the path of the structure
      # for instance, ('GCN', 'conv1', 'lin')
      path = path + (name,)
  
      # create namedtuple [path, (whether has) leaf, module]
      yield Trace(path, len(named_children) == 0, module)
  
      # recursively walk into all submodules
      for name, child_module in named_children:
          yield from _walk_modules(child_module, name=name, path=path)
  
imports: import functools
  from collections import OrderedDict, defaultdict, namedtuple
  from typing import Any, List, NamedTuple, Optional, Tuple
  import torch
  import torch.profiler
label_desc: Use image node_id 6 for calling a global function with example usage: _walk_modules(module, name, path) without return types