TensorFlow 2中tf.contrib.seq2seq.prepare_attention的等效性是什么

2024-04-24 05:12:13 发布

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

我最近正在编写一些用tensorflow 1.0.1编写的代码,我想让它在tenorflow 2上可用。 我对seq2seq不是很熟悉。 多谢各位

(attention_keys,
attention_values,
attention_score_fn,
attention_construct_fn) = tf.contrib.seq2seq.prepare_attention(
    attention_states=attention_states,
    attention_option="bahdanau",
    num_units=self.decoder_hidden_units,
)

Tags: 代码tftensorflowkeysconstructcontribpreparefn
1条回答
网友
1楼 · 发布于 2024-04-24 05:12:13

根据这个Github Commenttf.contrib.seq2seq.prepare_attention()被重命名为tf.contrib.seq2seq.DynamicAttentionWrapper

根据此Github Tensorflow CommitDynamicAttentionWrapper已重命名为AttentionWrapper

因此,在1.15中,等价于tf.contrib.seq2seq.prepare_attention()的函数是^{}

Tensorflow 2.x中等价于^{}的函数是^{}

请查找此Tensorflow Documentation以了解更多信息

相关问题 更多 >