code: def _verify_osd_by_load(
      self,
      model: nn.Module,
      optim: torch.optim.Optimizer,
      new_optim: torch.optim.Optimizer,
      dist_osd: Dict[str, Any],
  ) -> None:
      new_dist_osd = _gather_state_dict(dist_osd)
      set_state_dict(
          model,
          optimizers=new_optim,
          model_state_dict={},
          optim_state_dict=new_dist_osd,
      )
      self.assertEqual(optim.state_dict(), new_optim.state_dict())
  
file_path: pytorch/torch/testing/_internal/distributed/common_state_dict.py
imports: import copy
  from itertools import chain
  from typing import Any, Dict
  import torch
  import torch.nn
  from torch.distributed._sharded_tensor import ShardedTensor
  from torch.distributed._state_dict_utils import _gather_state_dict
  from torch.distributed._tensor import DTensor
  from torch.distributed.checkpoint.state_dict import PG, set_state_dict, STATE, StateDictOptions
label_desc: Use image node_id 4 for calling the VerifyStateDictMixin obj's underlying member method code with example usage: obj._verify_osd_by_load(model, optim, new_optim, dist_osd) without return types