LocalAggregation-Pytorch icon indicating copy to clipboard operation
LocalAggregation-Pytorch copied to clipboard

Why 'loss.backward()' is carried out before the k-means function?

Open MrYaoH opened this issue 3 years ago • 2 comments

In the ‘train_one_epoch‘ function,I notice that when 'loss.backward()' is carried out for the first time,the Ci is not clustered by k-means method. Clustering does not work until the second data batch in the first epoch enters. This problem make me confused. In other words,why 'loss.backward()' function is defined before the k-means function? In the paper, the k-means function should do before computing the loss. right?

MrYaoH avatar Apr 07 '21 05:04 MrYaoH

Sorry, I am not super familiar with the pytorch implementation, but I think even if for the first batch, the k-means is not done, it can just use the initial value of the C_i or previous saved values to do the computations, this would just make the first batch not used super well, which should be totally fine.

chengxuz avatar Apr 07 '21 13:04 chengxuz

Sorry, I am not super familiar with the pytorch implementation, but I think even if for the first batch, the k-means is not done, it can just use the initial value of the C_i or previous saved values to do the computations, this would just make the first batch not used super well, which should be totally fine.

Thank you for your reply. I sincerely appreciate your work.

MrYaoH avatar Apr 07 '21 14:04 MrYaoH