You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm not really using pytorch, but I want to use balanced kmeans. My code is as follows:
from torch import from_numpy
from balanced_kmeans import kmeans_equal
...
# load X, a 23000x59 ndarray
n_cluster = 50
X_tensor = from_numpy(X)
choices, centers = kmeans_equal(X_tensor,
num_clusters=n_cluster,
cluster_size=X.shape[0] // n_cluster)
I get the following error: RuntimeError: expand(torch.LongTensor{[59]}, size=[]): the number of sizes provided (0) must be greater or equal to the number of dimensions in the tensor (1)
Am I doing something wrong creating my tensor from numpy? I apologize because I am asking more of like a general pytorch question and not really specific to kmeans_pytorch (and tbh I'm a total pytorch newb!) Is there an example anywhere of using kmeans_equal on numpy data? I bet other people would find that useful. Thanks in advance for any tips you can provide!
The text was updated successfully, but these errors were encountered:
line 165, in kmeans_equal
selected_ind = torch.argsort(cluster_positions, dim=-1)[:, :cluster_size]
IndexError: too many indices for tensor of dimension 1
Process finished with exit code 1
Hi, I'm not really using pytorch, but I want to use balanced kmeans. My code is as follows:
I get the following error:
RuntimeError: expand(torch.LongTensor{[59]}, size=[]): the number of sizes provided (0) must be greater or equal to the number of dimensions in the tensor (1)
Am I doing something wrong creating my tensor from numpy? I apologize because I am asking more of like a general pytorch question and not really specific to kmeans_pytorch (and tbh I'm a total pytorch newb!) Is there an example anywhere of using kmeans_equal on numpy data? I bet other people would find that useful. Thanks in advance for any tips you can provide!
The text was updated successfully, but these errors were encountered: