小编skw*_*vie的帖子

升级后tensorflow 2中tf.contrib.legacy_seq2seq.attention_decoder的等效项

我在 TensorFlow 1.0 中有以下代码。我尝试使用 tf_upgrade_v2 脚本将其迁移到 TensorFlow 2.0。然而,在tf-2紧凑版本中没有找到等效的功能。

建议我使用tensorflow_addons。但是,我在 tf_addons 模块中没有看到等效的注意力解码器。请指导我。

decoder_outputs,decoder_state = tf.contrib.legacy_seq2seq.attention_decoder(
            decoder_inputs = decoder_inputs,
            initial_state = encoder_state,
            attention_states = encoder_outputs,
            cell = cell,
            output_size = word_embedding_dim,
            loop_function = None if mode=='pretrain' else feed_prev_loop,
            scope = scope
        )
Run Code Online (Sandbox Code Playgroud)

tf 1.0代码的链接在这里: https://github.com/yaushian/CycleGAN-sentiment-transfer/blob/master/lib/seq2seq.py

python tensorflow seq2seq tensorflow2.0 tensorflow1.15

5
推荐指数
1
解决办法
204
查看次数