I have an array with the shape of TxCxHxW
, how can I change the order inside a channel.
For example, I have a
and like to change it so I get b
as following (please note that it is just an example, in general, I am looking for a way fast to change the order inside the channel, The change of order is not random and we always have the pattern):
a = np.arange(48).reshape(4,3,2,2)
b = np.zeros_like(a)
b[0,:,:,:] =a[1,:,:,:]
b[1,:,:,:] =a[3,:,:,:]
b[2,:,:,:] =a[0,:,:,:]
b[3,:,:,:] =a[2,:,:,:]