Chapter 031 / 5
Attention Efficiency & Long Context
Implement sliding-window causal attention in PyTorch
Easy
Target interface
sliding_window_attention(q, k, v, window)Implement the function/class skeleton in the editor. Any correct approach is accepted.
Hints0 / 2
Reference solution
Your own code stays in the editor.