aqibsaeed / Multilabel-timeseries-classification-with-LSTM

Tensorflow implementation of paper: Learning to Diagnose with LSTM Recurrent Neural Networks.
Apache License 2.0
575 stars 187 forks source link

error in creating multilayer lstm #8

Closed shopeth closed 2 years ago

shopeth commented 5 years ago

hi,

Thank you for sharing the code. I got the following error when constructing the multilayer LSTM:

InvalidArgumentError: Dimensions must be equal, but are 128 and 65 for 'rnn/while/rnn/multi_rnn_cell/cell_0/lstm_cell/MatMul_1' (op: 'MatMul') with input shapes: [?,128], [65,256].

I am using tensorflow 1.12 on Windows 10.

I believe the issue is on how the multiple LSTM cells are in created. Specifically, this line multi_layer_cell = tf.nn.rnn_cell.MultiRNNCell([cell] * 2) likely creates two cell pointing to the same object. I was able to get rid of this issue by changing it to: multi_layer_cell = tf.nn.rnn_cell.MultiRNNCell[rnn_cell.LSTMCell(n_hidden, state_is_tuple=True) for _ in range(2)])