Commit 3c78fe60 by xiaotong

Merge branch 'master' of 47.105.50.196:NiuTrans/Toy-MT-Introduction

parents fbcf3b9f ea0c1096
...@@ -470,9 +470,9 @@ NLP问题的隐含结构假设 & 无隐含结构假设,端到端学习 \\ ...@@ -470,9 +470,9 @@ NLP问题的隐含结构假设 & 无隐含结构假设,端到端学习 \\
\begin{itemize} \begin{itemize}
\item 一个简单的例子:基于循环神经网络的翻译过程 \item 一个简单的例子:基于循环神经网络的翻译过程
\begin{itemize} \begin{itemize}
\item 顺序处理源语言单词 \item<1-> \textbf{编码器}顺序处理源语言单词
\item 源语言句子信息被表示在最后一个循环单元的输出中 \item<5-> 源语言句子信息被表示在最后一个循环单元的输出中
\item 逐词生成目标语译文 \item<6-> \textbf{解码器}利用源语言句子信息逐词生成目标语译文
\end{itemize} \end{itemize}
\end{itemize} \end{itemize}
%%% 运行实例的图 %%% 运行实例的图
...@@ -481,7 +481,7 @@ NLP问题的隐含结构假设 & 无隐含结构假设,端到端学习 \\ ...@@ -481,7 +481,7 @@ NLP问题的隐含结构假设 & 无隐含结构假设,端到端学习 \\
\setlength{\base}{0.6cm} \setlength{\base}{0.6cm}
\tikzstyle{rnnnode} = [minimum size=\base,inner sep=0pt,rounded corners=1pt,draw] \tikzstyle{rnnnode} = [minimum size=\base,inner sep=0pt,rounded corners=1pt,draw]
\tikzstyle{wordnode} = [font=\normalsize] \tikzstyle{wordnode} = [font=\normalsize,align=center]
\begin{scope} \begin{scope}
\visible<1->{ \visible<1->{
...@@ -505,63 +505,76 @@ NLP问题的隐含结构假设 & 无隐含结构假设,端到端学习 \\ ...@@ -505,63 +505,76 @@ NLP问题的隐含结构假设 & 无隐含结构假设,端到端学习 \\
\node[wordnode,below=0pt of emb3] (word3) {}; \node[wordnode,below=0pt of emb3] (word3) {};
\draw[-latex'] (emb3.north) to (rnn3.south); \draw[-latex'] (emb3.north) to (rnn3.south);
\draw[-latex'] (rnn2.east) to (rnn3.west); \draw[-latex'] (rnn2.east) to (rnn3.west);
\node[rnnnode,fill=blue!30!white,right=\base of rnn3] (rnn4) {}; \node[rnnnode,fill=blue!30!white,right=\base of rnn3] (rnn4) {};
\node[rnnnode,fill=green!30!white,below=\base of rnn4] (emb4) {}; \node[rnnnode,fill=green!30!white,below=\base of rnn4] (emb4) {};
\node[wordnode,below=0pt of emb4] (word4) {$\langle$eos$\rangle$}; \node[wordnode,below=0pt of emb4] (word4) {$\langle$eos$\rangle$};
\draw[-latex'] (emb4.north) to (rnn4.south); \draw[-latex'] (emb4.north) to (rnn4.south);
\draw[-latex'] (rnn3.east) to (rnn4.west); \draw[-latex'] (rnn3.east) to (rnn4.west);
} }
\visible<4>{ \visible<4->{
\node[rnnnode,fill=purple] (repr) at (rnn4) {}; \draw[decoration={mirror,brace},decorate] (word1.south west) to node [auto,anchor=north,align=center] {编码器} (word4.south east);
\node[wordnode,above=\base of repr] (label) {句子表示};
\draw[->,dashed] (label.south) to (rnn4.north);
} }
\visible<5->{ \visible<5->{
\node[rnnnode,fill=red!30!white,above=\base of rnn4] (softmax1) {}; \node[rnnnode,fill=purple] (repr) at (rnn4) {};
\node[wordnode,above=0pt of softmax1] (out1) {I}; \node[wordnode,above=\base of rnn2] (label) {源语言句子信息};
\draw[-latex'] (rnn4.north) to (softmax1.south); \draw[->,dashed,thick] (label.east) .. controls +(east:\base) and +(north:\base) .. (rnn4.north);
} }
\visible<6->{ \visible<6->{
\node[rnnnode,fill=blue!30!white,right=\base of rnn4] (rnn5) {}; \node[rnnnode,fill=blue!30!white,right=\base of rnn4] (rnn5) {};
\node[rnnnode,fill=green!30!white,below=\base of rnn5] (emb5) {}; \node[rnnnode,fill=green!30!white,below=\base of rnn5] (emb5) {};
\node[rnnnode,fill=red!30!white,above=\base of rnn5] (softmax2) {}; \node[wordnode,below=0pt of emb5] (word5) {$\langle$sos$\rangle$};
\ExtractX{$(emb5)$}
\ExtractY{$(word4.base)$}
\node[wordnode,anchor=base] (word5) at (\XCoord,\YCoord) {I};
\ExtractX{$(emb5)$}
\ExtractY{$(out1.base)$}
\node[wordnode,anchor=base] (out2) at (\XCoord,\YCoord) {am};
\draw[-latex'] (emb5.north) to (rnn5.south); \draw[-latex'] (emb5.north) to (rnn5.south);
\draw[-latex'] (rnn4.east) to (rnn5.west); \draw[-latex'] (rnn4.east) to (rnn5.west);
\draw[-latex'] (rnn5.north) to (softmax2.south); \node[rnnnode,fill=red!30!white,above=\base of rnn5] (softmax1) {};
\node[wordnode,above=0pt of softmax1] (out1) {I};
\draw[-latex'] (rnn5.north) to (softmax1.south);
} }
\visible<7->{ \visible<7->{
\node[rnnnode,fill=blue!30!white,right=\base of rnn5] (rnn6) {}; \node[rnnnode,fill=blue!30!white,right=\base of rnn5] (rnn6) {};
\node[rnnnode,fill=green!30!white,below=\base of rnn6] (emb6) {}; \node[rnnnode,fill=green!30!white,below=\base of rnn6] (emb6) {};
\node[rnnnode,fill=red!30!white,above=\base of rnn6] (softmax3) {}; \node[rnnnode,fill=red!30!white,above=\base of rnn6] (softmax2) {};
\ExtractX{$(emb6)$} \ExtractX{$(emb6)$}
\ExtractY{$(word4.base)$} \ExtractY{$(word4.base)$}
\node[wordnode,anchor=base] (word6) at (\XCoord,\YCoord) {am}; \node[wordnode,anchor=base] (word6) at (\XCoord,\YCoord) {I};
\ExtractX{$(emb6)$} \ExtractX{$(emb6)$}
\ExtractY{$(out1.base)$} \ExtractY{$(out1.base)$}
\node[wordnode,anchor=base] (out3) at (\XCoord,\YCoord) {fine}; \node[wordnode,anchor=base] (out2) at (\XCoord,\YCoord) {am};
\draw[-latex'] (emb6.north) to (rnn6.south); \draw[-latex'] (emb6.north) to (rnn6.south);
\draw[-latex'] (rnn5.east) to (rnn6.west); \draw[-latex'] (rnn5.east) to (rnn6.west);
\draw[-latex'] (rnn6.north) to (softmax3.south); \draw[-latex'] (rnn6.north) to (softmax2.south);
}
\visible<8->{
\node[rnnnode,fill=blue!30!white,right=\base of rnn6] (rnn7) {}; \node[rnnnode,fill=blue!30!white,right=\base of rnn6] (rnn7) {};
\node[rnnnode,fill=green!30!white,below=\base of rnn7] (emb7) {}; \node[rnnnode,fill=green!30!white,below=\base of rnn7] (emb7) {};
\node[rnnnode,fill=red!30!white,above=\base of rnn7] (softmax4) {}; \node[rnnnode,fill=red!30!white,above=\base of rnn7] (softmax3) {};
\ExtractX{$(emb7)$} \ExtractX{$(emb7)$}
\ExtractY{$(word4.base)$} \ExtractY{$(word4.base)$}
\node[wordnode,anchor=base] (word7) at (\XCoord,\YCoord) {fine}; \node[wordnode,anchor=base] (word7) at (\XCoord,\YCoord) {am};
\ExtractX{$(emb7)$} \ExtractX{$(emb7)$}
\ExtractY{$(out1.base)$} \ExtractY{$(out1.base)$}
\node[wordnode,anchor=base] (out4) at (\XCoord,\YCoord) {$\langle$eos$\rangle$}; \node[wordnode,anchor=base] (out3) at (\XCoord,\YCoord) {fine};
\draw[-latex'] (emb7.north) to (rnn7.south); \draw[-latex'] (emb7.north) to (rnn7.south);
\draw[-latex'] (rnn6.east) to (rnn7.west); \draw[-latex'] (rnn6.east) to (rnn7.west);
\draw[-latex'] (rnn7.north) to (softmax4.south); \draw[-latex'] (rnn7.north) to (softmax3.south);
\node[rnnnode,fill=blue!30!white,right=\base of rnn7] (rnn8) {};
\node[rnnnode,fill=green!30!white,below=\base of rnn8] (emb8) {};
\node[rnnnode,fill=red!30!white,above=\base of rnn8] (softmax4) {};
\ExtractX{$(emb8)$}
\ExtractY{$(word4.base)$}
\node[wordnode,anchor=base] (word8) at (\XCoord,\YCoord) {fine};
\ExtractX{$(emb8)$}
\ExtractY{$(out1.base)$}
\node[wordnode,anchor=base] (out4) at (\XCoord,\YCoord) {$\langle$eos$\rangle$};
\draw[-latex'] (emb8.north) to (rnn8.south);
\draw[-latex'] (rnn7.east) to (rnn8.west);
\draw[-latex'] (rnn8.north) to (softmax4.south);
}
\visible<9->{
\ExtractX{$(word8.east)$}
\ExtractY{$(word5.south)$}
\draw[decoration={mirror,brace},decorate] (word5.south west) to node [auto,anchor=north,align=center] {解码器} (\XCoord,\YCoord);
} }
\end{scope} \end{scope}
\end{tikzpicture} \end{tikzpicture}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论