在拼写检查器程序中获取attentionwrapper问题

2024-09-30 16:34:18 发布

您现在位置:Python中文网/ 问答频道 /正文

https://github.com/Currie32/Spell-Checker

在上面的链接代码中,我得到一个错误:DynamicAttentionWrapper没有定义。我使用的是TensorFlow版本1.2。我不能克服这个错误。请帮帮我


Tags: 代码https版本githubcom定义链接tensorflow
1条回答
网友
1楼 · 发布于 2024-09-30 16:34:18

您的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)

相关问题 更多 >