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

Class ChainInit

tensorpack/tfutils/sessinit.py:244–264  ·  view source on GitHub ↗

Initialize a session by a list of :class:`SessionInit` instance, executed one by one. This can be useful for, e.g., loading several models from different files to form a composition of models.

Source from the content-addressed store, hash-verified

242
243
244class ChainInit(SessionInit):
245 """
246 Initialize a session by a list of :class:`SessionInit` instance, executed one by one.
247 This can be useful for, e.g., loading several models from different files
248 to form a composition of models.
249 """
250
251 def __init__(self, sess_inits):
252 """
253 Args:
254 sess_inits (list[SessionInit]): list of :class:`SessionInit` instances.
255 """
256 self.inits = sess_inits
257
258 def _setup_graph(self):
259 for i in self.inits:
260 i._setup_graph()
261
262 def _run_init(self, sess):
263 for i in self.inits:
264 i._run_init(sess)
265
266
267def SmartInit(obj, *, ignore_mismatch=False):

Callers 1

SmartInitFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected