code: def dump_checkpoint(model, epoch, checkpoint_dir):
      if isinstance(model, nn.DataParallel):
          state_dict = model.module.state_dict()
      else:
          state_dict = model.state_dict()
      if not os.path.exists(checkpoint_dir):
          os.makedirs(checkpoint_dir)
      dest_path = os.path.join(
          checkpoint_dir, "epoch_{}.pth.tar".format(epoch)
      )
      logger.info("Saving model to %s", dest_path)
      torch.save(state_dict, dest_path)
  
file_path: nni/examples/nas/legacy/oneshot/spos/evaluation.py
imports: import os
  import argparse
  import logging
  import random
  import numpy
  import torch
  import torch.nn
  import torchvision.transforms
  import torchvision.datasets
  from nni.retiarii import fixed_arch
  from nni.retiarii.oneshot.pytorch.utils import AverageMeterGroup
  from torch.utils.tensorboard import SummaryWriter
  from network import ShuffleNetV2OneShot
  from utils import CrossEntropyLabelSmooth, accuracy, ToBGRTensor
label_desc: Use image node_id 3 for calling a global function with example usage: dump_checkpoint(model, epoch, checkpoint_dir) without return types