code: def test_restore_from_checkpoint(tmpdir, learner):
      np.random.seed(0)
      last_avg_err1, avg_err1, trainer1 = ffnet(learner)
      np.random.seed(0)
      last_avg_err2, avg_err2, trainer2 = ffnet(learner)
  
      assert np.allclose(last_avg_err1, last_avg_err2)
      assert np.allclose(avg_err1, avg_err2)
  
      # create a checkpoint for trainer and continue training
      checkpoint_filename = str(tmpdir.join("checkpoint"))
      trainer2.save_checkpoint(checkpoint_filename)
      np.random.seed(1)
      last_avg_err1, avg_err1, _ = ffnet(None, trainer1)
      np.random.seed(1)
      last_avg_err2, avg_err2, _ = ffnet(None, trainer2)
      assert np.allclose(last_avg_err1, last_avg_err2)
      assert np.allclose(avg_err1, avg_err2)
  
      # restore from the checkpoint, make sure results match the one without checkpointing
      trainer2.restore_from_checkpoint(checkpoint_filename)
      np.random.seed(1)
      last_avg_err2, avg_err2, _ = ffnet(None, trainer2)
      assert np.allclose(last_avg_err1, last_avg_err2)
      assert np.allclose(avg_err1, avg_err2)
  
imports: from __future__ import division, print_function
  import numpy
  import cntk
  from cntk import parameter
  import pytest
  import sys
  import itertools
  from cntk.logging import ProgressPrinter
  from cntk.learners import sgd, learning_rate_schedule, learning_parameter_schedule, UnitType, universal
  from cntk.layers import Dense, Sequential
label_desc: Use image node_id 20 for calling a global function with example usage: test_restore_from_checkpoint(tmpdir, learner) without return types