Open ashgoodman opened 7 years ago
@ashgoodman, you should use variable scope initialization as follows:
with tf.variable_scope('encoder_cell', reuse=True):
encoder_cell = LSTMCell(encoder_hidden_dimension)
instead of presented one.
I changed the dtype to be tf.float32, it worked fine after that.
None of the above fix this issue :/
@ketyi the same with me.. =/ Did you figure it out?
I would try to define the encoder as follows:
with tf.variable_scope('encoder_cell_fw'):
encoder_cell_fw = LSTMCell(encoder_hidden_units)
with tf.variable_scope('encoder_cell_bw'):
encoder_cell_bw = LSTMCell(encoder_hidden_units)
( (encoder_fw_outputs,
encoder_bw_outputs),
(encoder_fw_final_state,
encoder_bw_final_state)) = (
tf.nn.bidirectional_dynamic_rnn(cell_fw=encoder_cell_fw,
cell_bw=encoder_cell_bw,
inputs=encoder_inputs_embedded,
sequence_length=encoder_inputs_length,
dtype=tf.float32, time_major=False))
For me it (mysteriously) helped to put:
with tf.variable_scope('encoder_cell', reuse=False): encoder_cell = LSTMCell(encoder_hidden_units) ((encoder_fw_outputs, encoder_bw_outputs), (encoder_fw_final_state, encoder_bw_final_state)) = ( tf.nn.bidirectional_dynamic_rnn(cell_fw=encoder_cell, cell_bw=encoder_cell, inputs=encoder_inputs_embedded, sequence_length=encoder_inputs_length, dtype=tf.float32, time_major=True) )
And then rerun all of the cells in the jupyter notebook.
Did it work for anyone? I am still facing the issue. Neither of the solution posted above helps.
My config is: Ubuntu 14.04 Tensorflow: 0.10.0
Changed scope for all. And time_major=False. Then executed complete code. TF version 1.2.1 It worked fine for me.
with tf.variable_scope('encoder_cell', reuse=True): encoder_cell = LSTMCell(encoder_hidden_units) with tf.variable_scope('encoder_cell_bw', reuse=True): encoder_cell_bw = LSTMCell(encoder_hidden_units) with tf.variable_scope('encoder_cell_fw', reuse=True): encoder_cell_fw = LSTMCell(encoder_hidden_units)
( (encoder_fw_outputs, encoder_bw_outputs), (encoder_fw_final_state, encoder_bw_final_state)) = ( tf.nn.bidirectional_dynamic_rnn(cell_fw=encoder_cell_fw, cell_bw=encoder_cell_bw, inputs=encoder_inputs_embedded, sequence_length=encoder_inputs_length, dtype=tf.float32, time_major=False))
My tensorflow version is 1.3.0 . Above these solves are not working in this version. Can anyone give me a solution please ?
The following throws an error, please update
((encoder_fw_outputs, encoder_bw_outputs), (encoder_fw_final_state, encoder_bw_final_state)) = ( tf.nn.bidirectional_dynamic_rnn(cell_fw=encoder_cell, cell_bw=encoder_cell, inputs=encoder_inputs_embedded, sequence_length=encoder_inputs_length, dtype=tf.float64, time_major=True)