code: def test_load_state_dict(self):
      net = torch.nn.PReLU()
  
      # set up engine
      def _train_func(engine, batch):
          engine.state.metrics["val_loss"] = engine.state.iteration
  
      engine = Engine(_train_func)
  
      # set up testing handler
      with tempfile.TemporaryDirectory() as tempdir:
          engine = Engine(_train_func)
          CheckpointSaver(
              save_dir=tempdir,
              save_dict={"net": net},
              save_key_metric=True,
              key_metric_name="val_loss",
              key_metric_n_saved=2,
              key_metric_save_state=True,
              key_metric_negative_sign=True,
          ).attach(engine)
          engine.run(range(3), max_epochs=3)
  
          saver = CheckpointSaver(
              save_dir=tempdir,
              save_dict={"net": net},
              save_key_metric=True,
              key_metric_name="val_loss",
              key_metric_n_saved=2,
              key_metric_negative_sign=True,
          )
          engine = Engine(_train_func)
          CheckpointLoader(
              os.path.join(tempdir, "net_key_metric=-6.pt"),
              {"checkpointer": saver},
          ).attach(engine)
          engine.run(range(1), max_epochs=1)
  
          resumed = saver._key_metric_checkpoint._saved
          for i in range(2):
              self.assertEqual(resumed[1 - i].priority, -3 * (i + 1))
              self.assertEqual(
                  resumed[1 - i].filename,
                  f"net_key_metric=-{3 * (i + 1)}.pt",
              )
  
file_path: MONAI/tests/test_handler_checkpoint_saver.py
imports: from __future__ import annotations
  import os
  import tempfile
  import unittest
  import torch
  import torch.optim
  from ignite.engine import Engine
  from parameterized import parameterized
  from monai.handlers import CheckpointLoader, CheckpointSaver
label_desc: Use image node_id 3 for calling the TestHandlerCheckpointSaver obj's underlying member method code with example usage: obj.test_load_state_dict() without return types