Skip to content
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

Add assignment support for Sequential #4931

Merged
merged 5 commits into from Feb 7, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions torch/nn/modules/container.py
@@ -1,6 +1,4 @@
from collections import OrderedDict, Iterable
import string
import torch
from collections import OrderedDict
import warnings
from .module import Module

Expand Down Expand Up @@ -62,6 +60,9 @@ def __getitem__(self, idx):
next(it)
return next(it)

def __setitem__(self, idx, module):
return setattr(self, str(idx), module)

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.


def __len__(self):
return len(self._modules)

Expand Down