I am trying to draw a neural network like following, but I want to draw a square at the beginning, to be specific:
My neural Network:
\documentclass[12pt, oneside, letterpaper]{book}
\usepackage{amsmath,amssymb,amsfonts,amsthm}
\usepackage{graphicx}
\usepackage{neuralnetwork}
\usepackage{xpatch}
\makeatletter
\xpatchcmd{\linklayers}{\nn@lastnode}{\lastnode}{}{}
\xpatchcmd{\linklayers}{\nn@thisnode}{\thisnode}{}{}
\begin{document}
\begin{figure}[h]
\centering
\label{fig:arquitectura_autoencoder}
\begin{neuralnetwork}[height=9.5,nodespacing=1cm,nodesize=20pt, layerspacing=3.6cm][h]
%comandos previos
\newcommand{\x}[2]{\ifthenelse{\equal{#2}{0}}{$b_0$}{\ifnum #2=8 $x_n$ \else $x_#2$ \fi}} %si es el índice cero, entonces le asignas b0, sino si es la neurona 8, lo cambias por el índice n
\newcommand{\ffirst}[2]{\ifthenelse{\equal{#2}{0}}{$b_1$}
{\ifnum #2=4 $a_{\frac{n}{2}}^{(2)}$ \else $a_{#2}^{(2)}$ \fi}}
\newcommand{\fsecond}[2]{\ifthenelse{\equal{#2}{0}}{$b_2$}
{\ifnum #2=3 $a_{\frac{n}{4}}^{(3)}$ \else $a_{#2}^{(3)}$ \fi}}
\newcommand{\fthird}[2]{\ifthenelse{\equal{#2}{0}}{$b_3$}
{\ifnum #2=4 $a_{\frac{n}{2}}^{(4)}$ \else$a_{#2}^{(4)}$ \fi}}
\newcommand{\xhat}[2]{\ifthenelse{\equal{#2}{0}}{$b_0$}{\ifnum #2=8 $\hat{x}_n$ \else $\hat{x}_#2$ \fi}}
%red neuronal
\inputlayer[count=8, bias=true,exclude={7},title=Input\\layer, text=\x]
\hiddenlayer[count=4, bias=true,exclude={3},title={$L_2$\\$f_{\cdot 2} = \tanh(x)$}, text=\ffirst]
\linklayers[not from={7},not to={3}] %para que no dibuje la flecha desde la neurona 7
\hiddenlayer[count=3, bias=true,exclude={2}, title={$L_3$\\$f_{\cdot 3} = ReLU(x) $}, text=\fsecond]
\linklayers[not from={3},not to={2}]
\hiddenlayer[count=4, bias=true,exclude={3}, title={$L_4$\\$f_{\cdot 4} = \tanh(x)$}, text=\fthird]
\linklayers[not from={2},not to={3}]
\outputlayer[count=8, exclude={7},title={Output layer\\$\hat{x}_i=a_{i}^{(5)}$}, text=\xhat]
\linklayers[not to={7},not from={3}]
% draw dots
\path (L0-6) -- node{$\vdots$} (L0-8);
\path (L1-2) -- node{$\vdots$} (L1-4);
\path (L2-1) -- node{$\vdots$} (L2-3);
\path (L3-2) -- node{$\vdots$} (L3-4);
\path (L4-6) -- node{$\vdots$} (L4-8);
\end{neuralnetwork}
\end{figure}
\end{document}
Generates:
What I want is something similar, but I want a little square before the input layer and then the output layer because I want to add more information. I attach a similar image I want.
What I want:
Is this possible to do it? I think it is hard.


