code: def _sync_module_states(
      module: nn.Module,
      process_group: dist.ProcessGroup,
      broadcast_bucket_size: int,
      src: int,
      params_and_buffers_to_ignore: Container[str],
      broadcast_buffers: bool = True,
  ) -> None:
      """
      Sync ``module``'s parameters and buffers state.
  
      Syncs ``module``'s parameters and buffers state so that all ranks contain
      the same module state across all ranks. Note that this API assumes that all
      parameter shapes are consistent before running the synchronization. This can
      be checked with ``_verify_param_shape_across_processes``.
      """
      module_states: List[torch.Tensor] = []
      for name, param in module.named_parameters():
          if name not in params_and_buffers_to_ignore:
              module_states.append(param.detach())
  
      if broadcast_buffers:
          for name, buffer in module.named_buffers():
              if name not in params_and_buffers_to_ignore:
                  module_states.append(buffer.detach())
  
      _sync_params_and_buffers(
          process_group, module_states, broadcast_bucket_size, src
      )
  
imports: import dataclasses
  import traceback
  from typing import Any, Callable, Container, Dict, List, Optional, OrderedDict, Tuple, TypeVar, overload
  import torch
  import torch.distributed
  from torch import nn
  from torch.nn.parallel._functions import _get_stream
  from torch.nn.parallel.scatter_gather import _is_namedtuple
  from torch.nn.utils.rnn import PackedSequence
label_desc: Use image node_id 15 for calling a global function with example usage: _sync_module_states(module, process_group, broadcast_bucket_size, src, params_and_buffers_to_ignore, broadcast_buffers) without return types