[context] maintain the context object in with statement (#1073)

This commit is contained in:
Frank Lee
2022-06-07 10:48:45 +08:00
committed by GitHub
parent c5cd3b0f35
commit bfdc5ccb7b

View File

@@ -72,6 +72,7 @@ class InsertPostInitMethodToModuleSubClasses(object):
torch.nn.modules.module.Module.__init_subclass__ = classmethod(_init_subclass)
self._pre_context_exec()
return self
def __exit__(self, exc_type, exc_value, traceback):