mirror of https://github.com/hpcaitech/ColossalAI
[context] maintain the context object in with statement (#1073)
parent
c5cd3b0f35
commit
bfdc5ccb7b
|
@ -72,6 +72,7 @@ class InsertPostInitMethodToModuleSubClasses(object):
|
||||||
torch.nn.modules.module.Module.__init_subclass__ = classmethod(_init_subclass)
|
torch.nn.modules.module.Module.__init_subclass__ = classmethod(_init_subclass)
|
||||||
|
|
||||||
self._pre_context_exec()
|
self._pre_context_exec()
|
||||||
|
return self
|
||||||
|
|
||||||
def __exit__(self, exc_type, exc_value, traceback):
|
def __exit__(self, exc_type, exc_value, traceback):
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue