code: def restore_collection(backup):
      """
      Restore from a collection backup.
  
      Args:
          backup (dict):
      """
      for k, v in six.iteritems(backup):
          del tf.get_collection_ref(k)[:]
          tf.get_collection_ref(k).extend(v)
  
file_path: tensorpack/tensorpack/tfutils/collection.py
imports: from contextlib import contextmanager
  from copy import copy
  import six
  from ..compat import tfv1
  from ..utils import logger
  from ..utils.argtools import memoized
label_desc: Use image node_id 2 for calling a global function with example usage: restore_collection(backup) without return types