-
Notifications
You must be signed in to change notification settings - Fork 26.3k
[WIP] Add nn.ModuleDict (#4048) #5297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| return self._modules[key] | ||
|
|
||
| def __setitem__(self, key, module): | ||
| return setattr(self, key, module) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
| Arguments: | ||
| modules (dict): dict of modules to append | ||
| """ | ||
| if not isinstance(modules, dict): |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
@pytorchbot add to whitelist |
|
@rkaplan Are you planning to fix the tests? |
|
Here is mine |
|
@rkaplan I can make this ready if you are busy. |
|
@karandwivedi42 Go ahead :) |
Summary: Addresses: #4048 and #5297 (comment) Pull Request resolved: #8463 Reviewed By: SsnL Differential Revision: D8689291 Pulled By: ezyang fbshipit-source-id: 47e67d9bae1b64ec10771a2c00c56229463b1598
|
This is redundant I suppose, after #8463 |
Summary: Addresses: pytorch#4048 and pytorch#5297 (comment) Pull Request resolved: pytorch#8463 Reviewed By: SsnL Differential Revision: D8689291 Pulled By: ezyang fbshipit-source-id: 47e67d9bae1b64ec10771a2c00c56229463b1598
|
closing in favor of #8463 |
Summary: Addresses: pytorch#4048 and pytorch#5297 (comment) Pull Request resolved: pytorch#8463 Reviewed By: SsnL Differential Revision: D8689291 Pulled By: ezyang fbshipit-source-id: 47e67d9bae1b64ec10771a2c00c56229463b1598
Summary: Addresses: pytorch#4048 and pytorch#5297 (comment) Pull Request resolved: pytorch#8463 Reviewed By: SsnL Differential Revision: D8689291 Pulled By: ezyang fbshipit-source-id: 47e67d9bae1b64ec10771a2c00c56229463b1598
Issue #4048
This PR implements an nn.ModuleDict class. Its purpose is similar to nn.ModuleList (ensuring modules in a collection are properly registered) but it exposes a dict interface instead. See issue #4048 for discussion.
This PR is still untested as I have been unable to compile PyTorch from source on my Mac; please do not merge it yet. I am putting it out for feedback now until I find the chance to sit down and fix the compilation issues and test it myself.
This is my first contribution to PyTorch, please let me know if I should be doing anything differently. Cheers.