https://github.com/Currie32/Spell-Checker.
在上面的链接代码中,我得到了一个错误,即没有定义DynamicAttentionWrapper。我使用的是TensorFlow 1.2版本。我无法克服这个错误。请帮我做这个。
您的tensorflow
版本中存在DynamicAttentionWrapper
问题。
尝试将DynamicAttentionWrapper
更改为AttentionWrapper
或降级为tensorflow 1.1
。
对于您的tensorflow
版本,请尝试对initial_state, inference_logits and training_logits
:进行以下更改
initial_state = dec_cell.zero_state(batch_size=batch_size,dtype=tf.float32).clone(cell_state=enc_state)
inference_logits, _ ,_ = tf.contrib.seq2seq.dynamic_decode(inference_decoder,
output_time_major=False,
impute_finished=True,
maximum_iterations=max_target_length)
training_logits, _ ,_ = tf.contrib.seq2seq.dynamic_decode(training_decoder,
output_time_major=False,
impute_finished=True,
maximum_iterations=max_target_length)