perm specifies the order you arrange your old axes into the new ones.
So in case of [0,3,1,2] (if we count the axes from 0) then:
new axis 0 ← old 0
new axis 1 ← old 3
new axis 2 ← old 1
new axis 3 ← old 2
in particular, in the beginning you have (m, nh, nw, nc),
axis 0 doesn’t change, new axis 1 will be the old axis 3, which is nc, and so on