Thank you for your kind reply!
However, this definitely does not work as it reshapes the tensor by row instead of the grid. In this case, the output should be like
[1, 2, 3, 4,
5, 6, 7, 8,
9, 10, 11, 12,
13, 14, 15, 16]
which is not what I want.