yala / introdeeplearning

MIT License
266 stars 145 forks source link

Lab2.ipynb does not run with new tensorFlow #8

Open srinivasan3 opened 7 years ago

srinivasan3 commented 7 years ago

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

norikaisa commented 6 years ago

I have the same problem

leihamilton commented 6 years ago

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([lstmcell() for in xrange(2)], state_is_tuple=True)

zdhiman commented 5 years ago

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)