-
Notifications
You must be signed in to change notification settings - Fork 6.8k
make the slice of sequential a sequential #10630
Conversation
layers = list(self._children.values())[key] | ||
if isinstance(layers, list): | ||
with self.name_scope(): | ||
net = type(self)() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why type(self)? There is no guarantee that type(self)'s constructor accepts no arguments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is so that any blocks that inherit sequential blocks have this default implementation. Child class that have other arguments can choose to override this.
return list(self._children.values())[key] | ||
layers = list(self._children.values())[key] | ||
if isinstance(layers, list): | ||
with self.name_scope(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it better to set prefix directly to be the same as self instead of using name_scope?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, good point. this way we can get rid of one namescope
Found a minor bug in using _brief_print_list. in py3, dict.keys() doesn't return a list. https://github.com/apache/incubator-mxnet/blob/master/python/mxnet/gluon/parameter.py#L779 |
* make the slice of sequential a sequential * update per comment * py3 compat
* make the slice of sequential a sequential * update per comment * py3 compat
* make the slice of sequential a sequential * update per comment * py3 compat
Description
make the slice of sequential a sequential
Checklist
Essentials
Please feel free to remove inapplicable items for your PR.
Changes
Comments