MCPcopy Create free account
hub / github.com/tensorpack/tensorpack / __exit__

Method __exit__

tensorpack/tfutils/tower.py:138–149  ·  view source on GitHub ↗
(self, exc_type, exc_val, exc_tb)

Source from the content-addressed store, hash-verified

136 return self
137
138 def __exit__(self, exc_type, exc_val, exc_tb):
139 global _CurrentTowerContext
140 _CurrentTowerContext = None
141
142 if not self.has_own_variables:
143 diff_trainable_vars = self._collection_guard.get_collection_in_tower(tf.GraphKeys.TRAINABLE_VARIABLES)
144 assert len(diff_trainable_vars) == 0, \
145 "New TRAINABLE_VARIABLES shouldn't be created in {}: ".format(
146 self._name) + ', '.join([k.name for k in diff_trainable_vars])
147 for c in self._ctxs[::-1]:
148 c.__exit__(exc_type, exc_val, exc_tb)
149 return False
150
151 def __str__(self):
152 return "TowerContext(name={}, is_training={})".format(

Callers

nothing calls this directly

Calls 3

formatMethod · 0.80
joinMethod · 0.80

Tested by

no test coverage detected