Solved by JosueCom in post #5 
              
              
                I implemented NN, KNN and KMeans on a project I am working on only using PyTorch. You can find the implementation here with an example: Nearest Neighbor, K Nearest Neighbor and K Means (NN, KNN, KMeans) only using PyTorch · GitHub 
>>> import torch as th
>>> from clustering import KNN
>>> data = th.…