introdeeplearning icon indicating copy to clipboard operation
introdeeplearning copied to clipboard

Lab2.ipynb does not run with new tensorFlow

Open srinivasan3 opened this issue 8 years ago • 3 comments

Running the solutions cell: ValueError: Trying to share variable rnn/multi_rnn_cell/cell_0/lstm_cell/kernel, but specified shape (200, 400) and found shape (7697, 400).

srinivasan3 avatar Sep 08 '17 18:09 srinivasan3

I have the same problem

norikaisa avatar Jan 16 '18 15:01 norikaisa

You can change these two lines lstm_cell = tf.contrib.rnn.LSTMCell(hidden_size) multi_lstm_cells = tf.contrib.rnn.MultiRNNCell(cells=[lstm_cell] * 2, state_is_tuple=True)

To the following, it will work.

def lstm_cell(): return tf.contrib.rnn.LSTMCell(hidden_size) multi_lstm_cells = tf.contrib.rnn.MultiRNNCell([lstm_cell() for _ in xrange(2)], state_is_tuple=True)

leihamilton avatar Jan 27 '18 16:01 leihamilton

For Python 3 Replace xrange to range in the last line

def lstm_cell():
return tf.contrib.rnn.LSTMCell(hidden_size)
multi_lstm_cells = tf.contrib.rnn.MultiRNNCell([lstm_cell() for _ in range(2)], state_is_tuple=True)

zdhiman avatar Dec 10 '18 00:12 zdhiman