Solved by ptrblck in post #2 
              
              
                The fit() methods expects a numpy array of the complete dataset, so you would need to get all samples of the DataLoader before feeding them to KMeans().fit(). 
You could use MiniBatchKMeans and use the partial_fit method, if you want to feed each batch to it.