Implement RoPE applied to a [batch, heads, seq, head_dim] tensor

Transformer Architecture Internals4 / 7

Chapter 014 / 7

Transformer Architecture Internals

Implement RoPE applied to a [batch, heads, seq, head_dim] tensor

Medium
Target interface
build_rope_cache(seq, head_dim, base=10000.0, device='cpu')

Implement the function/class skeleton in the editor. Any correct approach is accepted.

Hints0 / 2
Reference solution
Your own code stays in the editor.