prepare op• 数据种类:tokens → tokens
• 调用: import fullseye as fs; fs.ledger.rope_rotate(tokens, positions=None, base: 'float' = 10000.0) -> 'np.ndarray'(要直接调用实现,import llmcore; llmcore.rope_rotate(tokens, positions=None, base: 'float' = 10000.0) -> 'np.ndarray';从台账取用则 opsllmcore.get("rope_rotate"))
基于旋转的位置编码(RoPE)→ tokens。由于是旋转,所以保持范数。
Su 等 2021。把偶奇对 (x₂ᵢ, x₂ᵢ₊₁) 旋转角度 pos · base**(−2i/d)。由于是平面旋转的直和,‖RoPE(x)‖ == ‖x‖ 严格成立(实测 8.9e-16), 而且旋转后 2 个向量的内积只由位置之差决定(把绝对位置移动 40 种,幅度 8.9e-15) —— “把相对位置嵌入内积”这一主张,原样成为验算。
Args:
tokens: (T, d) float。d 为偶数(为了成对旋转)。
positions: (T,) 的位置。None 则为 0..T−1。也可传入不连续的位置(截取的窗口)。
base: 角度的底。越大,低轴转得越慢(面向长上下文)。
Returns:
tokens (T, d) float: 按对旋转后的结果。每行的范数与输入相同。
• 示例数据目录(下载 URL / 许可证) —— 2-D 用 skimage.data(BSD/公有领域)加合成图,3-D 给出真实数据源(Stanford/PDS 等)的下载 URL。
• 算子来历与参考文献 —— 该算子族所依据的研究/方法出处。
• 算法的正典(作者、年份)与用途见上面的族使用指南。
• poc_attention_identities — py -3.11 examples/poc_attention_identities.py
tokens 作为输入)rms_norm · attention_scores · attention_apply · attention_softmax · attention_tiled · attention_linear · attention_grouped · kv_cache_decode
prepare)*Provenance: llmcore.py — LLMCORE 算子登记表。本条目由 tools/opdocs.py md 自动生成(请勿手工编辑)。*
© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.