我最近写了一些用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,
)发布于 2020-07-15 16:22:22
根据此Github Comment,tf.contrib.seq2seq.prepare_attention()将重命名为tf.contrib.seq2seq.DynamicAttentionWrapper。
根据此Github Tensorflow Commit,DynamicAttentionWrapper已重命名为AttentionWrapper。
因此,在1.15中,相当于tf.contrib.seq2seq.prepare_attention()的函数是tf.contrib.seq2seq.AttentionWrapper。
在Tensorflow 2.x中相当于tf.contrib.seq2seq.AttentionWrapper的函数是tfa.seq2seq.AttentionWrapper。
有关详细信息,请查找此Tensorflow Documentation。
https://stackoverflow.com/questions/62856917
复制相似问题