input and the output are of the same dimension