BinRoot / TensorFlow-Book

Accompanying source code for Machine Learning with TensorFlow. Refer to the book for step-by-step explanations.
http://www.tensorflowbook.com
MIT License
4.45k stars 1.21k forks source link

Fixed ValueError in ch10_rnn/Concept02_rnn.ipynb #37

Closed energyfirefox closed 6 years ago

energyfirefox commented 6 years ago

Fixed Attempt to have a second RNNCell use the weights of a variable scope that already has weights: 'rnn/basic_lstm_cell'; and the cell was not constructed as BasicLSTMCell(..., reuse=True). To share the weights of an RNNCell, simply reuse it in your second calculation, or create a new one with the argument reuse=True.

Add cell = rnn.BasicLSTMCell(self.hidden_dim, reuse=tf.get_variable_scope().reuse)