You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/03/15 02:15:11 UTC
[GitHub] feevos commented on issue #10101: gluon feature request: proper registration/initialization of layers inside a list (container) for custom (Hybrid)Blocks
feevos commented on issue #10101: gluon feature request: proper registration/initialization of layers inside a list (container) for custom (Hybrid)Blocks
URL: https://github.com/apache/incubator-mxnet/issues/10101#issuecomment-373237657
Hi @szha and @sxjscience thank you very much for your reply. So if I understand correctly, (Hybrid)Sequential can also be used as a container of the various layers and indexed just like a list **so I can use the contained layers in any _order_ I want** (without the stacked sequential forward functionality). If I understand correctly, I can use something like:
```Python
class CustomNet(HybridSequential):
def __init__(self,**kwards):
HybridSequential.__init__(self,**kwards)
with self.name_scope():
self.net = HybridSequential()
# Add some convolution operators
for i in range(3):
net.add(Conv2D(....))
# Change the order of the layers in the self.net.
# This is not equivalent to self.net(input)
def hybrid_forward(self,F, input):
out = self.net[2]( input)
out = self.net[0] (out)
out = self.net[1] (out)
return out
```
if my understanding is correct then yes, there is no need for something similar to ModuleList. I haven't seen anything like what you just described in the documentation (it would be nice to add it in the gluon [book](http://gluon.mxnet.io/) and API).
Thank you very much!
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services