What is the fastest and most elegant way to change a matrix dimension?
I would consider a sentence such as this to be unambiguous:

We flattened the $h \times w \times 3$ input data down to a two-dimensional $hw \times 3$ shape.

I don't believe a reference explaining this would be necessary.