aidan-plenert-macdonald opened a new issue #9486: LSTM doesn't work with 
Symbols - "'Symbol' object has no attribute 'shape'"
URL: https://github.com/apache/incubator-mxnet/issues/9486
 
 
   I am using the following versions,
   ```
   $ pip list | grep mxnet
   mxnet (1.0.0.post1)
   $ python --version
   Python 3.6.3
   ```
   
   When I run,
   ```python
   import mxnet as mx
   from mxnet import gluon
   
   class Net(gluon.Block):
       def __init__(self, recurrent_width, forward_width, **kwargs):
           super(Net, self).__init__(**kwargs)
           with self.name_scope():
               self._rnn = gluon.rnn.LSTM(recurrent_width)
               self._nn  = gluon.nn.Dense(forward_width)
   
       def forward(self, x):
           return self._nn(self._rnn(x))
   
   net = Net(10, 10)
   net(mx.sym.var('data'))
   ```
   
   I get,
   ```
   $ python shape_error.py 
   Traceback (most recent call last):
     File "shape_error.py", line 15, in <module>
       net(mx.sym.var('data'))
     File "/usr/local/lib/python3.6/site-packages/mxnet/gluon/block.py", line 
304, in __call__
       return self.forward(*args)
     File "shape_error.py", line 12, in forward
       return self._nn(self._rnn(x))
     File "/usr/local/lib/python3.6/site-packages/mxnet/gluon/block.py", line 
304, in __call__
       return self.forward(*args)
     File 
"/usr/local/lib/python3.6/site-packages/mxnet/gluon/rnn/rnn_layer.py", line 
173, in forward
       batch_size = inputs.shape[self._layout.find('N')]
   AttributeError: 'Symbol' object has no attribute 'shape'
   ```
   
   So the problem is occuring 
[here](https://github.com/apache/incubator-mxnet/blob/master/python/mxnet/gluon/rnn/rnn_layer.py#L173)
 because RNN Layer checks the shape right away.
   
   How can I fix this?

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to