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/10/11 19:23:02 UTC

[GitHub] szha commented on issue #12783: Name conflict when serializing LSTMCell

szha commented on issue #12783: Name conflict when serializing LSTMCell
URL: https://github.com/apache/incubator-mxnet/issues/12783#issuecomment-429086305
 
 
   The problem is in the sample code. Since HybridSequentialRNNCell is a container block, you need to use its name_scope if you intend to properly export it as a symbol.
   ```
   class MyBlock(mx.gluon.HybridBlock):
       def __init__(self):
           super().__init__()
           with self.name_scope():
               self.lstm = mx.gluon.rnn.HybridSequentialRNNCell()
               with self.lstm.name_scope():
                   for layer in range(3):
                       self.lstm.add(mx.gluon.rnn.LSTMCell(hidden_size=20))
   
       def hybrid_forward(self, F, seq):
           outputs, state = self.lstm.unroll(inputs=seq, length=10, layout="NTC", merge_outputs=True)
           return outputs
   ```

----------------------------------------------------------------
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