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

pull/1076/head
Frank Lee 2022-06-07 10:48:45 +08:00 committed by GitHub
parent c5cd3b0f35
commit bfdc5ccb7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

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):