Before the contrastive loss, SimCLR's projection head output is normalized to unit length. That turns the dot product into a cosine similarity, so the loss depends only on direction.
Implement l2_normalize(z), returning the vector scaled to unit length.
Divide by the norm, guarding the zero case.
No results yet
Run your code to check it against the examples, or submit to run every test.