I want to design a hidden Markov model using LaTeX. I write the below code, but I have a problem in drawing paths correctly. I encountered the error Package Pgf error: No shape named lds1lds1L1 is known. How can I solve it?
\documentclass{article}
\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{calc}
\usepackage{graphicx}
\usepackage[latin1]{inputenc}
\usetikzlibrary{positioning}
\usepackage{color}
\usepackage{caption}
\pgfmathsetseed{5}
\begin{document}
\begin{tikzpicture}[ lds/.pic={
\tikzstyle{main}=[circle, minimum size = .2cm, thick, draw =black!80, node distance = 3mm]
\tikzstyle{connect}=[-latex, thick]
\tikzstyle{box}=[rectangle, draw=black!100]
\node[box,draw=white!100] (Latent) {};
\node[main,minimum size=.2cm] (L1) [right=of Latent] {$x_1$};
\node[main,minimum size=.2cm] (L2) [right=of L1] {$x_2}$};
\node[main,minimum size=.2cm] (Lt) [right=of L2] {$x_T}$};
\node[box,draw=white!100] (Observed) [below=of Latent] {};
\node[main,fill=black,text=white,minimum size=.2cm] (O1) [right=of Observed,below=of L1] {$y_1$};
\node[main,fill=black,text=white,minimum size=.2cm] (O2) [right=of O1,below=of L2] {$y_2$};
\node[main,fill=black,text=white,minimum size=.2cm] (Ot) [right=of O2,below=of Lt] {$y_T$};
\path (L2) -- node[auto=false]{\ldots} (Lt);
\path (L1) edge [connect] (L2)
(L2) -- node[auto=false]{\ldots} (Lt);
(O2) -- node[auto=false]{\ldots} (Ot);
\path (L1) edge [connect] (O1);
\path (L2) edge [connect] (O2);
\path (Latent) edge [connect] (O1);
\draw[dashed] [below=of L1,above=of O1];
} ]
\pic(lds1) at (0,16){lds}; % <---the problem is here!!
\end{tikzpicture}
\end{document}