Transformer Architecture Internals · Problem 4 of 7
Implement RoPE applied to a [batch, heads, seq, head_dim] tensor.
Implement the function/class skeleton in the editor. Any correct approach is accepted.
import torch
def build_rope_cache(seq, head_dim, base=10000.0, device='cpu'):
raise NotImplementedError
def rotate_half(x):
raise NotImplementedError
def apply_rope(x, cos, sin):
raise NotImplementedErrorReady when you are
Submit your solution and a structured review appears here — verdict, score, and concrete feedback. Any correct approach passes.
Implement RoPE applied to a [batch, heads, seq, head_dim] tensor.
Implement the function/class skeleton in the editor. Any correct approach is accepted.