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?