code: def _swap_state(
      mod: nn.Module,
      names_map: Dict[str, List[str]],
      elems: Iterable[Tensor],
  ) -> List[Tensor]:
      result: List[Tensor] = []
      accessor = NamedMemberAccessor(mod)
      for (_, attr_names), elem in zip(names_map.items(), elems):
          for i, attr_name in enumerate(attr_names):
              if i == 0:
                  result.append(accessor.swap_tensor(attr_name, elem))
              else:
                  accessor.set_tensor(attr_name, elem)
      return result
  
imports: import copy
  from typing import Any, Callable, Dict, Iterable, List, NoReturn, Sequence, Tuple, Type, Union
  import torch
  import torch.nn
  from torch import Tensor
  from torch.nn.utils._named_member_accessor import NamedMemberAccessor
label_desc: Use image node_id 7 for calling a global function with example usage: _swap_state(mod, names_map, elems) and returns: result