嵌入Tensorflow的NMT教程后编码器的GRU单元是否应该正确

时间:2019-06-05 07:03:30

标签: python tensorflow machine-learning nlp

在Tensorflow的NMT注意教程中,我发现GRU单元在解码器中的位置与教程中的图不同。

我还阅读了注意论文https://arxiv.org/pdf/1409.0473.pdf。 如果本教程使用RNN编码器-解码器模型,则GRU单元应与编码器保持相同的权重,而不仅仅是隐藏的向量。

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>build-helper-maven-plugin</artifactId>
    <version>3.0.0</version>
    <executions>
        <execution>
            <phase>generate-sources</phase>
            <goals>
                <goal>add-source</goal>
            </goals>
            <configuration>
                <sources>
                    <source>${project.build.directory}/generated-sources/gen-java</source><!-- adjust folder name to your needs -->
                </sources>
            </configuration>
        </execution>
    </executions>
</plugin>

在tensorflow NMT注意教程(网页https://www.tensorflow.org/alpha/tutorials/text/nmt_with_attention#write_the_encoder_and_decoder_model)中,Decoder类将输入放入嵌入中。然后,嵌入文本仅与注意上下文向量连接在一起。串联后,串联后将其馈入GRU。 但是,根据页面中的图,红色块是GRU单位。在GRU单元计算出嵌入文本后,隐藏向量及其输出。然后,我们将GRU输出向量与上下文向量连接起来。最后,FC层会将级联的向量传输到结果字。 我想问一下为什么本教程要使GRU单元处于串联之后,并且解码器中的该GRU单元是否应该从编码器的GRU单元继承而来?

谢谢

0 个答案:

没有答案