Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FlashAttention needs contiguous gradients #548

Merged
merged 2 commits into from
Nov 29, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix lint
  • Loading branch information
fmassa committed Nov 29, 2022
commit 7ee130512689a4b59e90da205c2b6054f178d9ca
4 changes: 3 additions & 1 deletion tests/test_mem_eff_attention.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,9 @@ def test_backward(

grad_out = torch.ones_like(out)
if grad_out_contiguous is False:
grad_out = torch.tensor([1.0], dtype=query.dtype, device=device)[None, None, :].expand_as(out)
grad_out = torch.tensor([1.0], dtype=query.dtype, device=device)[
None, None, :
].expand_as(out)

out.backward(grad_out)
del out
Expand Down