MCPcopy Index your code
hub / github.com/tensorpack/tensorpack / backup_collection

Function backup_collection

tensorpack/tfutils/collection.py:19–34  ·  view source on GitHub ↗

Args: keys (list): list of collection keys to backup. Defaults to all keys in the graph. Returns: dict: the backup

(keys=None)

Source from the content-addressed store, hash-verified

17
18
19def backup_collection(keys=None):
20 """
21 Args:
22 keys (list): list of collection keys to backup.
23 Defaults to all keys in the graph.
24
25 Returns:
26 dict: the backup
27 """
28 if keys is None:
29 keys = tf.get_default_graph().get_all_collection_keys()
30 ret = {}
31 assert isinstance(keys, (list, tuple, set))
32 for k in keys:
33 ret[k] = copy(tf.get_collection(k))
34 return ret
35
36
37def restore_collection(backup):

Callers 6

__call__Method · 0.85
BatchNormFunction · 0.85
BatchRenormFunction · 0.85
freeze_collectionFunction · 0.85
__enter__Method · 0.85
__exit__Method · 0.85

Calls 1

get_collectionMethod · 0.80

Tested by

no test coverage detected