Skip to content
fn

rotary_pos_embedding_op

→TensorImplPtr
int rotary_pos_embedding_op(const int & input, const int & position_ids_or_null, bool interleaved)

Apply Rotary Position Embedding to input — free-function entry point.

Thin wrapper that delegates to RotaryPosEmbeddingBackward::forward.

Parameters

inputTensorImplPtr
Input of shape (…,L,D)(\ldots, L, D) with D even.
position_ids_or_nullTensorImplPtr
Optional integer position-index tensor of shape (L,); pass null to use the implicit [0, 1, …, L-1].
interleavedbool
Pair-layout flag (see RotaryPosEmbeddingBackward).

Returns

TensorImplPtr

Rotated output with the same shape as input.