答案1
针对每个问题都有很多帖子,现在又多了一个帖子。例如,神经网络与这个帖子。
\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{arrows.meta,chains}
\begin{document}
\begin{tikzpicture}[neuron/.style={circle,inner sep=1em,draw},
neuron missing/.style={
scale=1.25,
text height=0.333cm,
execute at begin node=$\vdots$,
}]
\begin{scope}[x=3cm,y=2cm]
\foreach \X/\Y [count=\Z,remember=\Y as \LastY] in {Input/2,Hidden/3,Hidden/4,Output/2}
{\foreach \YY in {1,...,\Y}
{\node[neuron] (n-\Z-\YY) at (\Z,-\YY+\Y/2+1/2) {};
\ifnum\YY=1
\node[above=1em of n-\Z-\YY,font=\sffamily] {\X\ layer};
\else
\path (n-\Z-\the\numexpr\YY-1) -- (n-\Z-\YY)
node[midway,neuron missing] {};
\fi
\ifnum\Z>1
\foreach \YYY in {1,...,\LastY}
{\draw[-{Triangle},semithick] (n-\the\numexpr\Z-1\relax-\YYY) -- (n-\Z-\YY) ;}
\fi
}}
\end{scope}
\path[nodes={inner sep=1pt}]
(n-2-2.-80) node[below right]{$x_i^\ell$}
(n-3-3.-80) node[below right]{$x_j^{\ell+1}$}
(n-3-3.west) node[left=2pt]{$w_{ij}^{\ell}$}
(n-4-2.-90) node[below]{$\widehat{y_k}$};
\end{tikzpicture}
\begin{tikzpicture}[box/.style={draw,thick,minimum width=5em,minimum
height=1.2em},arj/.style={semithick,-latex}]
\begin{scope}[start chain=A going below,oc/.style={join=by arj,on chain},
font=\sffamily,node distance=1.75em]
\node[box,oc]{Layer};
\node[box,oc,label={north west:{$F(x_\ell)$}}]{Layer};
\node[circle,oc,draw,thick,node font=\bfseries\large,inner sep=1pt,
label={left:{$F(x_\ell)+x_\ell$}}]{+};
\node[oc]{$x_{\ell+1}$};
\end{scope}
\draw[arj,latex-] (A-1.north) -- ++ (0,1.75em)
coordinate[midway,label=left:{$x_\ell$}](aux);
\draw[arj] (aux) -- ++ (2em,0) to[out=0,in=0,looseness=1.5]
node[midway,right]{$h(x_\ell)=x_\ell$}(A-3);
\end{tikzpicture}
\end{document}