code: def testPruneStopAndRestart_PreservesSparsity(self, save_restore_fn):
      # TODO(tfmot): renable once SavedModel preserves step again.
      # This existed in TF 2.0 and 2.1 and should be reenabled in
      # TF 2.3. b/151755698
      if save_restore_fn.__name__ == "_save_restore_tf_model":
          return
  
      begin_step, end_step = 1, 4
      params = self.params
      params["pruning_schedule"] = pruning_schedule.PolynomialDecay(
          0.2, 0.6, begin_step, end_step, 3, 1
      )
  
      model = prune.prune_low_magnitude(
          keras_test_utils.build_simple_dense_model(), **params
      )
      model.compile(
          loss="categorical_crossentropy",
          optimizer="sgd",
          metrics=["accuracy"],
      )
      # Model hasn't been trained yet. Sparsity 0.0
      test_utils.assert_model_sparsity(self, 0.0, model)
  
      # Train only 1 step. Sparsity 0.2 (initial_sparsity)
      self._train_model(model, epochs=1)
      test_utils.assert_model_sparsity(self, 0.2, model)
  
      model = save_restore_fn(model)
  
      # Training has run all 4 steps. Sparsity 0.6 (final_sparsity)
      self._train_model(model, epochs=3)
      test_utils.assert_model_sparsity(self, 0.6, model)
  
      self._check_strip_pruning_matches_original(model, 0.6)
  
imports: import tempfile
  from absl.testing import parameterized
  import numpy
  import tensorflow
  from tensorflow_model_optimization.python.core.keras import test_utils
  from tensorflow_model_optimization.python.core.sparsity.keras import prune
  from tensorflow_model_optimization.python.core.sparsity.keras import prune_registry
  from tensorflow_model_optimization.python.core.sparsity.keras import pruning_callbacks
  from tensorflow_model_optimization.python.core.sparsity.keras import pruning_schedule
  from tensorflow_model_optimization.python.core.sparsity.keras import pruning_wrapper
  from tensorflow_model_optimization.python.core.sparsity.keras import test_utils
label_desc: Use image node_id 27 for calling the PruneIntegrationTest obj's underlying member method code with example usage: obj.testPruneStopAndRestart_PreservesSparsity(save_restore_fn) without return types