Once the equidistant locations in the latent space \(\mathbf {P}^e\)  are identified, they can be used to enforce separation in the latent representations of images from different classes. As each latent representation matures with training, it might need to change its associativity with its initial group. We propose a novel formulation in algo:LearningWithSpacing that would allow for this flexibility during learning. The training essentially alternates between learning with pseudo-labels derived from class prototypes (Lines 6 - 8) and modifying the class prototypes themselves (Lines 11 - 15). In Line 1, we initialize the class prototypes \(\mathbf {P}\)  as the centroids of latents from \(\Phi _{\mathbf {\theta }}\)  using \(k\) -means [1]}. Based on the closeness to these prototypes, the class associativity of each image in a mini-batch is determined in Line 7. The feature extractor is updated to make the latent representations closer to these prototypes in Line 8. Using these newer features, the assignment is recomputed and the prototypes themselves are updated in Line 15. For each data-point \(z_i\) , its corresponding prototype \(\mathbf {p}_{c_{\mathbf {z}_i}}\)  is moved closer to the equidistant point \(\mathbf {p}^e_{c_{\mathbf {z}_i}}\)  and its current representation, controlled by a momentum parameter \(\eta \) . The parameter \(\eta \)  dampens with more instances of the specific class seen during training.
