code: def save_checkpoint_vars(dic, path):
      """
      Save variables in dic to path.
  
      Args:
          dic: {name: value}. values have to be numpy arrays
          path: save as npz if the name ends with '.npz', otherwise save as a checkpoint.
      """
      logger.info("Variables to save to {}:".format(path))
      keys = sorted(dic.keys())
      logger.info(pprint.pformat(keys))
  
      assert not path.endswith(".npy")
      if path.endswith(".npz"):
          np.savez_compressed(path, **dic)
      else:
          with tfv1.Graph().as_default(), tfv1.Session() as sess:
              for k, v in six.iteritems(dic):
                  k = get_op_tensor_name(k)[0]
                  _ = tfv1.Variable(name=k, initial_value=v)  # noqa
              sess.run(tfv1.global_variables_initializer())
              saver = tfv1.train.Saver()
              saver.save(sess, path, write_meta_graph=False)
  
imports: import glob
  import operator
  import numpy
  import os
  import pprint
  import six
  import tensorflow
  from ..compat import tfv1
  from ..utils import logger
  from .common import get_op_tensor_name
label_desc: Use image node_id 3 for calling a global function with example usage: save_checkpoint_vars(dic, path) without return types