Input and output in latex algorithm [duplicate]

In latex, I am writing a pseudocode where I want to have output (of input and output) in the following fashion:

This is my code:

\documentclass[sigconf]{acmart}
\usepackage{amsmath}

\usepackage{algorithm}
\usepackage{algpseudocode}
\begin{document}
\begin{algorithm}\label{algo:ProclivityProp2}
\caption{Graph}
\begin{algorithmic}
\State Input T matrix of measurements
\State Output  $\hat X$ \quad matrix of graph signals\\
$\hat W$ \quad matrix of outliers\\
\end{algorithmic}
\end{algorithm}
\end{document}


And this is my output:

When I use \Input{..} or \Output{..} in my code, I get the following error:

! Undefined control sequence.<recently read> \Input \Input
! Undefined control sequence \Output


How can I get the desired output (the first picture)?

• Don't think this is a duplicate question because this one is implicitly asking how to align the text for multiple inputs Jul 26 at 14:28

It is easiest to produce output where the "Input" and "Output" headings are on lines of their own, which may be good enough for your purposes:

\documentclass[sigconf]{acmart}
\usepackage{amsmath}

\usepackage{algorithm}
\usepackage{algpseudocode}

\algblock{Input}{EndInput}
\algnotext{EndInput}
\algblock{Output}{EndOutput}
\algnotext{EndOutput}
\newcommand{\Desc}[2]{\State \makebox[2em][l]{#1}#2}

\begin{document}
\begin{algorithm}\label{algo:ProclivityProp2}
\caption{Graph}
\begin{algorithmic}
\Input
\Desc{T}{matrix of measurements}
\EndInput
\Output
\Desc{$\hat X$}{matrix of graph signals}
\Desc{$\hat W$}{matrix of outliers}
\EndOutput
\end{algorithmic}
\end{algorithm}
\end{document}