code: def _load_pretrained_encoder(
      model: nn.Module, state_dict: OrderedDict | dict
  ):
      model_dict = model.state_dict()
      state_dict = {
          k: v
          for k, v in state_dict.items()
          if (k in model_dict)
          and (model_dict[k].shape == state_dict[k].shape)
      }
  
      model_dict.update(state_dict)
      model.load_state_dict(model_dict)
      if len(state_dict.keys()) == 0:
          warnings.warn(
              "no key will be updated. Please check if 'pretrained_url' or `pretrained_state_dict_key` is correct."
          )
      else:
          print(
              f"{len(state_dict)} out of {len(model_dict)} keys are updated with pretrained weights."
          )
  
imports: from __future__ import annotations
  import os
  import re
  import warnings
  from collections import OrderedDict
  from collections.abc import Callable, Sequence
  import torch
  import torch.nn
  from monai.apps.utils import download_url
  from monai.networks.blocks import UpSample
  from monai.networks.layers.factories import Conv, Dropout
  from monai.networks.layers.utils import get_act_layer, get_norm_layer
  from monai.utils.enums import HoVerNetBranch, HoVerNetMode, InterpolateMode, UpsampleMode
  from monai.utils.module import export, look_up_option
label_desc: Use image node_id 1 for calling a global function with example usage: _load_pretrained_encoder(model, state_dict) without return types