Attention Efficiency & Long Context · Problem 1 of 5
Implement sliding-window causal attention in PyTorch.
Implement the function/class skeleton in the editor. Any correct approach is accepted.
import torch
import torch.nn.functional as F
def sliding_window_attention(q, k, v, window):
raise NotImplementedErrorReady when you are
Submit your solution and a structured review appears here — verdict, score, and concrete feedback. Any correct approach passes.
Implement sliding-window causal attention in PyTorch.
Implement the function/class skeleton in the editor. Any correct approach is accepted.