Neural Mastery
← Practice
Practice: Rotary Positional Embedding (RoPE) From Scratchhard

Practice: Rotary Positional Embedding (RoPE) From Scratch

hardllms-genai⏱ 15–20 min
Libraries allowed · Pure Python earns +10 bonus XP
🎯 Mission
Implement Practice: Rotary Positional Embedding (RoPE) From Scratch and verify your implementation in the interactive AI/ML IDE workspace.

Task

Implement `rotary_positional_embedding`. Libraries (NumPy, PyTorch, SciPy) are allowed, but Pure Python implementations earn bonus XP!

Function Signature

rotary_positional_embedding(*args, **kwargs)

Examples

Example 1: Smoke Test
Input: {}
Output:
Explanation: Executes your function against default test inputs.

Constraints

  • Libraries (NumPy, PyTorch, SciPy) are allowed and accepted normally.
  • Pure Python (no external libraries) earns +10 Bonus XP!
  • Must handle edge cases (empty inputs, invalid shapes, boundary conditions) correctly.
Python3Saved ✓
def rotary_positional_embedding(*args, **kwargs):
"""Implement Practice: Rotary Positional Embedding (RoPE) From Scratch.
Return the expected output according to the problem specification below."""
# Your implementation here
pass

Case 1: Smoke Test
Input: {}
Expected: