braindecode.functional.rotary_angles#
- braindecode.functional.rotary_angles(positions, inv_freq, interleaved=True)[source]#
Rotation angles of each position, laid out to match the feature layout.
- Parameters:
positions (
Tensor) – Shape(...,); same dtype asinv_freqfor exact angles.inv_freq (
Tensor) – Shape(head_dim // 2,), fromrotary_frequencies().interleaved (
bool) –Truerepeats each angle for its adjacent pair (rotate_pairs());Falseconcatenates the angles twice (rotate_half()).
- Returns:
Shape
(..., head_dim); pass.cos()and.sin()toapply_rotary().- Return type: