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