code: def test_resume_training_on_cpu(tmpdir):
      """Checks if training can be resumed from a saved checkpoint on CPU."""
      # Train a model on TPU
      model = BoringModel()
      trainer = Trainer(max_epochs=1, accelerator="tpu", devices="auto")
      trainer.fit(model)
  
      if trainer.world_size != trainer.num_devices:
          # we're in multinode. unless the filesystem is shared, only the main node will have access to the checkpoint
          # since we cannot know this, the code below needs to be skipped
          return
  
      model_path = trainer.checkpoint_callback.best_model_path
  
      # Verify saved Tensors are on CPU
      ckpt = torch.load(model_path)
      weight_tensor = list(ckpt["state_dict"].values())[0]
      assert weight_tensor.device == torch.device("cpu")
  
      # Verify that training is resumed on CPU
      trainer = Trainer(max_epochs=1, default_root_dir=tmpdir)
      trainer.fit(model, ckpt_path=model_path)
  
imports: import collections
  import os
  from copy import deepcopy
  from unittest import mock
  from unittest.mock import MagicMock, call, patch
  import lightning.fabric
  import pytest
  import torch
  from lightning.fabric.utilities.imports import _IS_WINDOWS
  from lightning.pytorch import Trainer
  from lightning.pytorch.accelerators import CPUAccelerator, XLAAccelerator
  from lightning.pytorch.demos.boring_classes import BoringModel, RandomDataset
  from lightning.pytorch.plugins import Precision, XLACheckpointIO, XLAPrecision
  from lightning.pytorch.strategies import DDPStrategy, XLAStrategy
  from lightning.pytorch.utilities import find_shared_parameters
  from torch import nn
  from torch.utils.data import DataLoader
  from tests_pytorch.helpers.runif import RunIf
  from tests_pytorch.trainer.connectors.test_accelerator_connector import DeviceMock
  from tests_pytorch.trainer.optimization.test_manual_optimization import assert_emtpy_grad
label_desc: Use image node_id 1 for calling a global function with example usage: test_resume_training_on_cpu(tmpdir) without return types