code: def is_leaf_module(mod: nn.Module) -> bool:
      """The default implementation of leaf module detection.
  
      If you want to add more leaf modules, use :func:`profiler_leaf_module` to register them.
  
      Note that the interpretation of leaf module is finally decided by the profiler.
      We also make no guarantee that the profiler will not peak into a leaf module.
      This is only a utility function to reduce the effort of writing a profiler.
      """
      if isinstance(mod, ParametrizedModule):
          return True
      if any(
          isinstance(mod, registered) for registered in _leaf_registry
      ):
          return True
      return (
          mod.__class__.__module__.startswith("torch.nn")
          and not isinstance(mod, nn.Sequential)
          and not isinstance(mod, nn.ModuleList)
          and not isinstance(mod, nn.ModuleDict)
      )
  
file_path: nni/nni/nas/profiler/pytorch/utils/misc.py
imports: from __future__ import annotations
  from typing import Any, Callable, TypeVar, Type
  from torch import nn
  from nni.nas.nn.pytorch import ParametrizedModule
label_desc: Use image node_id 3 for calling a global function with example usage: is_leaf_module(mod) and returns: unknown, True, True