The first reverses width and height, and the second moves the channels to dimension zero, the way PyTorch expects. Though in the absence of any explanation, using two transposes (that could be one) make the author’s intention even more unclear!
I’d guess that numpy’s transpose does not move any data but only fiddles with indexing. So using an extra transpose does not cost much.
To me it just looks like poor commenting, which results in more confusion for the next person.