Skip to content

Instantly share code, notes, and snippets.

@fg91
Created March 16, 2019 22:43
Show Gist options
  • Save fg91/44fca99448f6ba2a93b9128ba4b4dd73 to your computer and use it in GitHub Desktop.
Save fg91/44fca99448f6ba2a93b9128ba4b4dd73 to your computer and use it in GitHub Desktop.
def cos_loss(input, target):
return 1 - F.cosine_similarity(input, target).mean()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment