-
Notifications
You must be signed in to change notification settings - Fork 275
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix to allow creation of custom crypten.nn networks inheriting direct…
…ly from crypten.nn.Module (#165) Summary: Pull Request resolved: fairinternal/CrypTen#165 This fix allows the creation of custom crypten.nn networks directly, analogous to the creation of the custom PyTorch networks. It ensures that any crypten.nn submodule created within a subclass of a crypten.nn.Module is registered within the calling module. This is achieved by redefining `__getattr__` and `__setattr__` similar to PyTorch: `__setattr__`: https://github.com/pytorch/pytorch/blob/2171f910531be28f7d5dd8e6ab8bff3a5486e6fd/torch/nn/modules/module.py#L578 `__getattr__`: https://github.com/pytorch/pytorch/blob/2171f910531be28f7d5dd8e6ab8bff3a5486e6fd/torch/nn/modules/module.py#L562 This fixes the bug identified by T58626019. Reviewed By: shubho Differential Revision: D18839679 fbshipit-source-id: c01ce8aa1d60cf99cef7da72f68558c3f3b77157
- Loading branch information
1 parent
f26b80c
commit 9f7a2e0
Showing
2 changed files
with
176 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters