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

Method __init__

tensorpack/tfutils/sessinit.py:94–107  ·  view source on GitHub ↗

Args: model_path (str): a model name (model-xxxx) or a ``checkpoint`` file. prefix (str): during restore, add a ``prefix/`` for every variable in this checkpoint. ignore (tuple[str]): tensor names that should be ignored during loading, e.g. learning-rate

(self, model_path, prefix=None, ignore=())

Source from the content-addressed store, hash-verified

92 Restore a tensorflow checkpoint saved by :class:`tf.train.Saver` or :class:`ModelSaver`.
93 """
94 def __init__(self, model_path, prefix=None, ignore=()):
95 """
96 Args:
97 model_path (str): a model name (model-xxxx) or a ``checkpoint`` file.
98 prefix (str): during restore, add a ``prefix/`` for every variable in this checkpoint.
99 ignore (tuple[str]): tensor names that should be ignored during loading, e.g. learning-rate
100 """
101 if model_path.endswith('.npy') or model_path.endswith('.npz'):
102 logger.warn("SaverRestore expect a TF checkpoint, but got a model path '{}'.".format(model_path) +
103 " To load from a dict, use 'DictRestore'.")
104 model_path = get_checkpoint_path(model_path)
105 self.path = model_path # attribute used by AutoResumeTrainConfig!
106 self.prefix = prefix
107 self.ignore = [i if i.endswith(':0') else i + ':0' for i in ignore]
108
109 def _setup_graph(self):
110 dic = self._get_restore_dict()

Callers

nothing calls this directly

Calls 2

get_checkpoint_pathFunction · 0.85
formatMethod · 0.80

Tested by

no test coverage detected