code: def average_parameters_or_parameter_groups(
      params: Union[
          Iterable[torch.nn.Parameter],
          Iterable[Dict[str, torch.nn.Parameter]],
      ],
      process_group: ProcessGroup,
  ):
      """
      Averages parameters of a model or parameter groups of an optimizer.
      """
      average_parameters(
          iter(get_params_to_average(params)), process_group
      )
  
file_path: pytorch/torch/distributed/algorithms/model_averaging/utils.py
imports: import itertools
  from typing import Union, Iterable, Dict, Iterator
  import torch
  import torch.distributed
  from torch.distributed import ProcessGroup, group
label_desc: Use image node_id 3 for calling a global function with example usage: average_parameters_or_parameter_groups(params, process_group) without return types