Actually, that’s all I explained…
I already have prototypes so I just need to compute centroids of these prototypes according to the labels.
for inputs, labels in train_loader:
   prototypes = network(inputs) # network: Resnet + FC layer.
   # I want to compute centroids of each class.

I think computing centroid is something like this…
for i, prototypes, labels enumerate(all_samples):
   if label == i:
      centroid[i] = prototypes / number_of_class_i

But I’m not sure about this.