\usepackage[ruled,vlined]{algorithm2e}

\definecolor{commentcolor}{RGB}{110,154,155}   % define comment color
\newcommand{\PyComment}[1]{\ttfamily\textcolor{commentcolor}{\# #1}}  % add a "#" before the input text "#1"
\newcommand{\PyCode}[1]{\ttfamily\textcolor{black}{#1}} % \ttfamily is the code font

...

\begin{algorithm}[h]
\SetAlgoLined
    \PyComment{this is a comment} \\
    \PyComment{this is a comment} \\
    \PyComment{} \\
    \PyComment{going to have indentation} \\
    \PyCode{for i in range(N):} \\
    \Indp   % start indent
        \PyComment{your comment} \\
        \PyCode{your code} \PyComment{inline comment} \\ 
    \Indm % end indent, must end with this, else all the below text will be indented
    \PyComment{this is a comment} \\
    \PyCode{your code}
\caption{PyTorch-style pseudocode for your-algo}
\label{algo:your-algo}
\end{algorithm}


I use the above latex code to construct a Pytorch-Style (more to a Python-Style) pseudocode algorithm table.