code: def old_style_save_and_load():
      # create a model and add parameters.
      m = dy.Model()
      a = m.add_parameters((100, 100))
      b = m.add_lookup_parameters((20, 2))
      t1 = Transfer(5, 6, dy.softmax, m)
      t2 = Transfer(7, 8, dy.softmax, m)
      tt = MultiTransfer([10, 10, 10, 10], dy.tanh, m)
      c = m.add_parameters((100))
      lb = dy.LSTMBuilder(1, 2, 3, m)
      lb2 = dy.LSTMBuilder(2, 4, 4, m)
      # save
      m.save("test1")
  
      # create new model (same parameters):
      m2 = dy.Model()
      a2 = m2.add_parameters((100, 100))
      b2 = m2.add_lookup_parameters((20, 2))
      t12 = Transfer(5, 6, dy.softmax, m2)
      t22 = Transfer(7, 8, dy.softmax, m2)
      tt2 = MultiTransfer([10, 10, 10, 10], dy.tanh, m2)
      c2 = m2.add_parameters((100))
      lb2 = dy.LSTMBuilder(1, 2, 3, m2)
      lb22 = dy.LSTMBuilder(2, 4, 4, m2)
  
      # parameters should be different
      for p1, p2 in [
          (a, a2),
          (b, b2),
          (c, c2),
          (t1.W, t12.W),
          (tt.transfers[0].W, tt2.transfers[0].W),
      ]:
          assert not numpy.array_equal(p1.as_array(), p2.as_array())
  
      m2.load("test1")
  
      # parameters should be same
      for p1, p2 in [
          (a, a2),
          (b, b2),
          (c, c2),
          (t1.W, t12.W),
          (tt.transfers[0].W, tt2.transfers[0].W),
      ]:
          assert numpy.array_equal(p1.as_array(), p2.as_array())
  
      os.remove("test1")
  
imports: from __future__ import print_function
  import dynet
  import numpy
  import os
label_desc: Use image node_id 1 for calling a global function with example usage: old_style_save_and_load() without return types