We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents d44b46b + 896616b commit 2945515Copy full SHA for 2945515
1 file changed
test/ops/self_attention.py
@@ -15,7 +15,7 @@ def torch_self_attention(attn_val, query, key, value, scale):
15
L, S = query.size(-2), key.size(-2)
16
attn_bias = torch.zeros(L, S, dtype=query.dtype, device=query.device)
17
18
- temp_mask = torch.ones(L, S, dtype=torch.bool).tril(diagonal=0)
+ temp_mask = torch.ones(L, S, dtype=torch.bool).tril(diagonal=S-L)
19
attn_bias.masked_fill_(temp_mask.logical_not(), float("-inf"))
20
attn_bias.to(query.dtype)
21
0 commit comments