Skip to content

Instantly share code, notes, and snippets.

@jacobsapps
Created April 6, 2026 12:42
Show Gist options
  • Select an option

  • Save jacobsapps/3e996136811fb2bd21ba89ba0507a222 to your computer and use it in GitHub Desktop.

Select an option

Save jacobsapps/3e996136811fb2bd21ba89ba0507a222 to your computer and use it in GitHub Desktop.
L2 Normalization with Accelerate from Apple Photos, Face Tagging, and Embeddings
var norm: Float = 0
vDSP_svesq(embedding, 1, &norm, vDSP_Length(count))
norm = sqrt(norm)
if norm > 0 {
vDSP_vsdiv(embedding, 1, &norm, &embedding, 1, vDSP_Length(count))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment