I need to Reproduce the torch net in pytorch, especially the RNN layer part.
and this is my pytorch net
when I run it, it produce an error message
RuntimeError: matrices expected, got 1D, 2D tensors at /b/wheel/pytorch-src/torch/lib/TH/generic/THTensorMath.c:1232
and the error code is
x7 = self.rnn(x6)
anyone helps me? Thanks!
The size of RNN’s input should be ( seq_len, batch, input_size)
,see the docs for detail.
if your batch_size =1 , you should x6 = self.fc(x5).unsqueeze(1)
.
yes, you’re right. Thanks a lot!