rope_rotate — LLMCORE prepare op

• Data kinds: tokens → tokens

• Call: import fullseye as fs; fs.ledger.rope_rotate(tokens, positions=None, base: 'float' = 10000.0) -> 'np.ndarray' (implementation को सीधे call करना हो तो import llmcore; llmcore.rope_rotate(tokens, positions=None, base: 'float' = 10000.0) -> 'np.ndarray', registry से लेना हो तो opsllmcore.get("rope_rotate"))

उपयोग

rotary position encoding (RoPE) → tokens। rotation है, इसलिए norm बनाए रखता है।

Su आदि 2021। हर even/odd जोड़े (x₂ᵢ, x₂ᵢ₊₁) को कोण pos · base**(−2i/d) जितना घुमाया जाता है। यह plane rotations का direct sum है, इसलिए ‖RoPE(x)‖ == ‖x‖ ठीक-ठीक लागू होता है (measured 8.9e-16), और घुमाए गए 2 vectors का inner product केवल position के अंतर से तय होता है (absolute position को 40 तरह से खिसकाने पर फैलाव 8.9e-15) — "relative position को inner product में बिठाना" वाला दावा सीधे cross-check बन जाता है।

Args:

tokens: (T, d) float। d even है (जोड़ों में घुमाने के लिए)।

positions: (T,) positions। None हो तो 0..T−1। बीच-बीच से छूटी positions (काटा गया window) भी दी जा सकती हैं।

base: कोणों का base। जितना बड़ा, निचले axes उतने धीरे घूमते हैं (लंबे context के लिए)।

Returns:

tokens (T, d) float: हर जोड़े को घुमाकर। हर row का norm input जैसा ही है।

उपयोग की विस्तृत guide

• llmcore family guide

संदर्भ (sample data, साहित्य)

• Sample data catalog (DL URL / license) — 2-D के लिए skimage.data (BSD/public) + synthetic, 3-D के लिए real data sources (Stanford/PDS आदि) के DL URL।

• Operators का स्रोत और संदर्भ — इस op family के मूल research/methods के स्रोत।

• Algorithm का मानक स्रोत (लेखक, वर्ष) और उपयोग ऊपर की family usage guide में दिए गए हैं।

चलाए जा सकने वाले उदाहरण (verified samples जो सच में यह op call करते हैं)

• poc_attention_identities — py -3.11 examples/poc_attention_identities.py

वे अगले ops जिनसे type जुड़ता है (tokens को input के रूप में लेते हैं)

rms_norm · attention_scores · attention_apply · attention_softmax · attention_tiled · attention_linear · attention_grouped · kv_cache_decode

इसी category के (prepare)

rms_norm


*Provenance: llmcore.py — LLMCORE operator registry. यह per-op note tools/opdocs.py md से अपने-आप generate होता है (हाथ से edit न करें)।*

© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.