code: def _named_params_with_replica(
      module: nn.Module,
      prefix: str = "",
      recurse: bool = True,
  ) -> Iterator[Tuple[str, Union[nn.Parameter, ColoTensor]]]:
      modules = (
          module.named_modules(prefix=prefix)
          if recurse
          else [(prefix, module)]
      )
  
      for mod_prefix, mod in modules:
          for name, val in mod._parameters.items():
              if val is None:
                  continue
              name = mod_prefix + ("." if mod_prefix else "") + name
              yield name, val
  
file_path: colossalai/colossalai/legacy/zero/gemini/colo_init_context.py
imports: from typing import Any, Iterator, Optional, Tuple, Union
  import torch
  from torch import nn
  from colossalai.legacy.tensor import ProcessGroup
  from colossalai.tensor import ColoParameter, ColoTensor
  from colossalai.utils.model.utils import InsertPostInitMethodToModuleSubClasses
label_desc: Use image node_id 1 for calling a global function with example usage: _named_params_with_replica(module, prefix, recurse) without return types