Skip to content

Instantly share code, notes, and snippets.

@Juraj-Sulimanovic
Last active May 21, 2024 12:19
Show Gist options
  • Save Juraj-Sulimanovic/76dfa5b58617597acd0ecb4c502434ea to your computer and use it in GitHub Desktop.
Save Juraj-Sulimanovic/76dfa5b58617597acd0ecb4c502434ea to your computer and use it in GitHub Desktop.
scores = torch.matmul(query, keys.transpose(2, 3)) / math.sqrt(self.head_size)
scores = F.softmax(scores.float(), dim=-1).type_as(query)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment