I received tensor of 4 dimensions (805, 8, 8, 128) from latent space of autoencoder (as input it was tensor of (1108, 32, 32, 3) - 1108 arrays of 32x32 pictures of 3 colors)

now I want to apply k-means to my feature tensor of 4 dimensions (805, 8, 8, 128), but every kmeans function I try (from sklearn, scipy etc) it through an error that number of dimensions different than 1 or 2 are not supported

how could i find clusters above all my arrays of feature tensor?

thank you for the links! i think i just don’t understand how reshaping array would not lead to loosing information (it was also in a comments to stackoverflow question but still not getting the clear understanding)

like when i flatten the array from 3d to 1d it turns out to be completely different data, isn’t it?