1

Have a tensor X:

X.shape = [2, 3, 4, 5]

This tensor represents pictures.
X[0] - number of pic.
X[1] -  Chanels
X[2],X[3] -  Height and Width.

I want to convert this tensor to shape [40,2] where second dim is 3 channels, and first all pixels in input data, which correspond channels in right order. try to use

reshape(-1,3)

but chanels are in incorrect order. How i can convert it? It is also interesting how i can to convert back, from [40,2] to [2,3,4,5]

SOLUTION

Find solution fo my case:

x.permute(1,0,2,3).reshape(3,-1).T

from this X: enter image description here

to this X: enter image description here

iGero
  • 383
  • 1
  • 3
  • 6

0 Answers0