code: def test_checkpoint_params(self):
      def add_input_ops(model):
          pass
  
      def add_model_ops(model, loss_scale):
          model.NHWC2NCHW("data", "data_nchw")
          model.Conv(
              "data_nchw",
              "conv1",
              3,
              64,
              weight_init=("MSRAFill", {}),
              kernel=7,
              stride=2,
              pad=3,
              no_bias=0,
          )
          model.SpatialBN(
              "conv1",
              "conv1_spatbn_relu",
              64,
              epsilon=1e-3,
              is_test=False,
          )
          model.Relu("conv1_spatbn_relu", "conv1_spatbn_relu")
          model.MaxPool(
              "conv1_spatbn_relu", "pool1", kernel=3, stride=2
          )
          model.FC("pool1", "fc", dim_in=(64 * 56 * 56), dim_out=100)
          model.Sigmoid("fc", "fc_sigm")
          model.Softmax("fc_sigm", "softmax")
          model.LabelCrossEntropy(["softmax", "label"], "xent")
          loss = model.AveragedLoss("xent", "loss")
  
          # Add a duplicate param init to ensure it does not cause issues
          model.param_init_net.ConstantFill(
              [], ["fc_w"], shape=((64 * 56 * 56), 1000)
          )
          return [loss]
  
      def add_optimizer(model):
          optimizer.build_sgd(model, 0.1, policy="fixed", momentum=0.9)
  
      model = cnn.CNNModelHelper(
          order="NHWC",
          name="test",
      )
      data_parallel_model.Parallelize_CPU(
          model,
          input_builder_fun=add_input_ops,
          forward_pass_builder_fun=add_model_ops,
          optimizer_builder_fun=add_optimizer,
          devices=[1, 2, 3],
      )
  
      # Only gpu_1 params should be returned (gpu_1 is the first gpu)
      checkpoint_params = data_parallel_model.GetCheckpointParams(model)
      for p in model.GetParams("cpu_1/"):
          self.assertTrue(p in checkpoint_params)
          self.assertTrue(p + "_momentum" in checkpoint_params)
      for p in model.GetParams("cpu_2/"):
          self.assertFalse(p in checkpoint_params)
      self.assertTrue(
          core.BlobReference("cpu_1/fc_w_momentum") in checkpoint_params
      )
      for c in model.GetComputedParams("cpu_1/"):
          self.assertTrue(c in checkpoint_params)
      for c in model.GetComputedParams("cpu_2/"):
          self.assertFalse(c in checkpoint_params)
      self.assertFalse(
          core.BlobReference("cpu_1/data") in checkpoint_params
      )
      self.assertTrue(
          core.BlobReference("optimizer_iteration") in checkpoint_params
      )
  
imports: from multiprocessing import Process, Queue
  import numpy
  import os
  import shutil
  import tempfile
  import unittest
  import time
  from unittest.mock import Mock
  from hypothesis import assume, given, settings
  import hypothesis.strategies
  from caffe2.proto import caffe2_pb2
  from caffe2.python import brew, core, cnn, data_parallel_model, dyndep, model_helper, optimizer, rnn_cell, workspace
  from caffe2.python.test_util import TestCase
label_desc: Use image node_id 4 for calling the DataParallelModelTest obj's underlying member method code with example usage: obj.test_checkpoint_params() and returns: list