Skip to content
fn

flip_op

→TensorImplPtr
int flip_op(const int & a, int dims)

Python wrappers

Public Python APIs implemented by this engine symbol.

Reverse a tensor along one or more axes.

Equivalent to NumPy's np.flip: along each listed axis the index ordering is inverted. Unlike roll_op there is no wrap-around.

Parameters

aTensorImplPtr
Input tensor.
dimsvector<int>
Axes to flip.

Returns

TensorImplPtr

Tensor of the same shape and dtype as a with the requested axes reversed.

Notes

Backward applies flip with the same dims to the incoming gradient — flipping is self-inverse.