Yes! you are right about transpose(-1, -2) for a. As I used same constant value for all cells of each patch, the result of transpose and reshape was identical.
Concerning the last reshape, it just works like flatten as we want to merge dim=1 and dim=2 into 1D tensor with size=100. In result we are not transposing any dim with any other and as you mentioned in your question, it is more like concatenating them in the same way they already are. What do you think?