[Tex/LaTex] How to draw a simple recurrent neural network with Goodfellow’s style

drawtikz-graphdrawingtikz-graphstikz-pgf

I need to draw a recurrent neural network that has the same architecture has the following one

enter image description here

In other words, a RNN with one input, one single hidden and recurrent unit and one output.

However, I would like it to have the following Goodfellow's style, so, in other words, I want all units to be (white or gray) circles.

enter image description here

I tried to look at other posts. For example, the following one: How to Draw Recurrent Neural Network, but I am not sure know how to modify the code.

Best Answer

I am not sure if this is the purpose of this site. IMHO you should try yourself and if you get stuck you will get much more enthusiastic answers, but anyway...

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{positioning,chains}
\begin{document}
\begin{tikzpicture}[item/.style={circle,draw,thick,align=center},
itemc/.style={item,on chain,join}]
 \begin{scope}[start chain=going right,nodes=itemc,every
 join/.style={-latex,very thick},local bounding box=chain]
 \path node (A0) {$A$} node (A1) {$A$} node (A2) {$A$} node[xshift=2em] (At)
 {$A$};
 \end{scope}
 \node[left=1em of chain,scale=2] (eq) {$=$};
 \node[left=2em of eq,item] (AL) {$A$};
 \path (AL.west) ++ (-1em,2em) coordinate (aux);
 \draw[very thick,-latex,rounded corners] (AL.east) -| ++ (1em,2em) -- (aux) 
 |- (AL.west);
 \foreach \X in {0,1,2,t} 
 {\draw[very thick,-latex] (A\X.north) -- ++ (0,2em)
 node[above,item,fill=gray!10] (h\X) {$h_\X$};
 \draw[very thick,latex-] (A\X.south) -- ++ (0,-2em)
 node[below,item,fill=gray!10] (x\X) {$x_\X$};}
 \draw[white,line width=0.8ex] (AL.north) -- ++ (0,1.9em);
 \draw[very thick,-latex] (AL.north) -- ++ (0,2em)
 node[above,item,fill=gray!10] {$h_t$};
 \draw[very thick,latex-] (AL.south) -- ++ (0,-2em)
 node[below,item,fill=gray!10] {$x_t$};
 \path (x2) -- (xt) node[midway,scale=2,font=\bfseries] {\dots};
\end{tikzpicture}
\end{document}

enter image description here