Skip to content

Commit

Permalink
Small fix in SDPA docstring codeblock (#109086)
Browse files Browse the repository at this point in the history
Fix #109072

Pull Request resolved: #109086
Approved by: https://github.com/drisspg
  • Loading branch information
mikaylagawarecki authored and pytorchmergebot committed Sep 12, 2023
1 parent 1b9b3a2 commit abd83ce
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion torch/nn/functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -4922,7 +4922,7 @@ def scaled_dot_product_attention(query, key, value, attn_mask=None, dropout_p=0.
if attn_mask is not None:
if attn_mask.dtype == torch.bool:
attn_mask.masked_fill_(attn_mask.logical_not(), float("-inf"))
attn_bias.masked_fill_(attn_mask.logical_not(), float("-inf"))
else:
attn_bias += attn_mask
attn_weight = query @ key.transpose(-2, -1) * scale_factor
Expand Down

0 comments on commit abd83ce

Please sign in to comment.