Skip to content
fn

roll_op

→TensorImplPtr
int roll_op(const int & a, int shifts, int axes)

Python wrappers

Public Python APIs implemented by this engine symbol.

Circularly shift elements along one or more axes.

For each (shift, axis) pair, rotates the tensor along that axis by shift positions; elements that fall off one end wrap around to the other.

Parameters

aTensorImplPtr
Input tensor.
shiftsvector<int64>
Signed shift amount per axis.
axesvector<int>
Axes to shift. Must match shifts in length.

Returns

TensorImplPtr

Tensor of the same shape and dtype as a.

Notes

Backward applies the inverse circular shift (negated shifts) to the incoming gradient, which exactly undoes the forward rotation.