code: def test_resnet_pretrained(
      self, model, input_param, input_shape, expected_shape
  ):
      net = model(**input_param).to(device)
      # Save ckpt
      torch.save(net.state_dict(), self.tmp_ckpt_filename)
  
      cp_input_param = copy.copy(input_param)
      # Custom pretrained weights
      cp_input_param["pretrained"] = self.tmp_ckpt_filename
      pretrained_net = model(**cp_input_param)
      equal_state_dict(net.state_dict(), pretrained_net.state_dict())
  
      if has_hf_modules:
          # True flag
          cp_input_param["pretrained"] = True
          resnet_depth = int(
              re.search(r"resnet(\d+)", model.__name__).group(1)
          )
  
          (
              bias_downsample,
              shortcut_type,
          ) = get_medicalnet_pretrained_resnet_args(resnet_depth)
  
          # With orig. test cases
          if (
              input_param.get("spatial_dims", 3) == 3
              and input_param.get("n_input_channels", 3) == 1
              and input_param.get("feed_forward", True) is False
              and input_param.get("shortcut_type", "B") == shortcut_type
              and (
                  input_param.get("bias_downsample", True)
                  == bool(bias_downsample)
                  if bias_downsample != -1
                  else True
              )
          ):
              model(**cp_input_param)
          else:
              with self.assertRaises(NotImplementedError):
                  model(**cp_input_param)
  
          # forcing MedicalNet pretrained download for 3D tests cases
          cp_input_param["n_input_channels"] = 1
          cp_input_param["feed_forward"] = False
          cp_input_param["shortcut_type"] = shortcut_type
          cp_input_param["bias_downsample"] = (
              bool(bias_downsample) if bias_downsample != -1 else True
          )
          if cp_input_param.get("spatial_dims", 3) == 3:
              with skip_if_downloading_fails():
                  pretrained_net = model(**cp_input_param).to(device)
                  medicalnet_state_dict = (
                      get_pretrained_resnet_medicalnet(
                          resnet_depth, device=device
                      )
                  )
                  medicalnet_state_dict = {
                      key.replace("module.", ""): value
                      for key, value in medicalnet_state_dict.items()
                  }
                  equal_state_dict(
                      pretrained_net.state_dict(), medicalnet_state_dict
                  )
  
imports: from __future__ import annotations
  import copy
  import os
  import re
  import sys
  import unittest
  from typing import TYPE_CHECKING
  import torch
  from parameterized import parameterized
  from monai.networks import eval_mode
  from monai.networks.nets import ResNet, get_medicalnet_pretrained_resnet_args, get_pretrained_resnet_medicalnet, resnet10, resnet18, resnet34, resnet50, resnet101, resnet152, resnet200
  from monai.networks.nets.resnet import ResNetBlock
  from monai.utils import optional_import
  from tests.utils import equal_state_dict, skip_if_downloading_fails, skip_if_no_cuda, skip_if_quick, test_script_save
label_desc: Use image node_id 4 for calling the TestResNet obj's underlying member method code with example usage: obj.test_resnet_pretrained(model, input_param, input_shape, expected_shape) without return types