code: def filter_state_dict(
      dst_state: Dict[str, Union[float, torch.Tensor]],
      src_state: Dict[str, Union[float, torch.Tensor]],
  ):
      """Filter name, size mismatch instances between dicts.
  
      Args:
          dst_state: reference state dict for filtering
          src_state: target state dict for filtering
  
      """
      match_state = {}
      for key, value in src_state.items():
          if key in dst_state and (
              dst_state[key].size() == src_state[key].size()
          ):
              match_state[key] = value
          else:
              if key not in dst_state:
                  logging.warning(
                      f"Filter out {key} from pretrained dict"
                      + " because of name not found in target dict"
                  )
              else:
                  logging.warning(
                      f"Filter out {key} from pretrained dict"
                      + " because of size mismatch"
                      + f"({dst_state[key].size()}-{src_state[key].size()})"
                  )
      return match_state
  
imports: import logging
  from typing import Any, Dict, Union
  import torch
  import torch.nn
  import torch.optim
label_desc: Use image node_id 1 for calling a global function with example usage: filter_state_dict(dst_state, src_state) and returns: match_state