# Writing PyTorch style pseudocode

Hi all. In few research papers I have found that pseudocode for an algorithm is written in PyTorch style. Is there any format for writing these PyTorch style pseudocode. If yes, kindly post the related link.

PS: It would be beneficial if you also post some more research papers with PyTorch style pseudocode.

Thank you

2 Likes

can you share some of these papers you mentioned so we can see what the style looks like?

1 Like
\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