Is there some clean way to do K-Means clustering on Tensor data without converting it to numpy array.
I have a list of tensors and their corresponding labes and this is what I am doing.
def evaluateKMeansRaw(data, true_labels, n_clusters):
kmeans = KMeans(n_clusters=n_clusters,n_init=20)
kmeans.fit(data)

acc = cluster_acc(true_labels, kmeans.labels_)
nmi = metrics.normalized_mutual_info_score(true_labels, kmeans.labels_)
return acc, nmi

But this doesn’t work on the output of a Conv Layer