Hi, i need to change the order of channels of a Tensor Variable from RGB to BGR, i can’t take it off from the Variable, someone can help me?
thank you in advance
1 Like
You can index the variables in the order you want, e.g.
> t = torch.Tensor(np.arange(12).reshape(4, 3))
> permute = [2, 1, 0]
> t[:, permute]
tensor([[ 2., 1., 0.],
[ 5., 4., 3.],
[ 8., 7., 6.],
[ 11., 10., 9.]])
13 Likes
Thank you! it’s what i was searching for