This is a pytorch implementation of k-means clustering algorithm
Python
348
92 commits
updated Mar 4, 2025
this is a pytorch implementation of K-means clustering algorithm
pip install fast-pytorch-kmeans
from fast_pytorch_kmeans import KMeans
import torch
kmeans = KMeans(n_clusters=8, mode='euclidean', verbose=1)
x = torch.randn(100000, 64, device='cuda')
labels = kmeans.fit_predict(x)
Tested on google colab with Intel(R) Xeon(R) CPU @ 2.00GHz and Nvidia Tesla T4 GPU
note: time cost for transfering data from cpu to gpu is also included
775 followers · starred Jun 2023
39 followers · starred Mar 2024
286 followers · starred Aug 2024
This is a pytorch implementation of k-means clustering algorithm
Python
348
92 commits
updated Mar 4, 2025
this is a pytorch implementation of K-means clustering algorithm
pip install fast-pytorch-kmeans
from fast_pytorch_kmeans import KMeans
import torch
kmeans = KMeans(n_clusters=8, mode='euclidean', verbose=1)
x = torch.randn(100000, 64, device='cuda')
labels = kmeans.fit_predict(x)
Tested on google colab with Intel(R) Xeon(R) CPU @ 2.00GHz and Nvidia Tesla T4 GPU
note: time cost for transfering data from cpu to gpu is also included
775 followers · starred Jun 2023
39 followers · starred Mar 2024
286 followers · starred Aug 2024