Skip to content
fn

unbind_op

→vector<TensorImplPtr>
int unbind_op(const int & a, int axis)

Python wrappers

Public Python APIs implemented by this engine symbol.

Unbind a tensor into a list of slices along an axis, dropping that axis.

Produces a.shape[axis] tensors, each with rank ndim - 1. The k-th output is a[..., k, ...] along axis with the split dimension squeezed away.

See Also

stack_op (the inverse), split_op.

Parameters

aTensorImplPtr
Input tensor with rank >= 1.
axisint
Axis to unbind along. Supports negative indexing.

Returns

vector<TensorImplPtr>

a.shape[axis] tensors of rank ndim - 1.

Notes

Backward inserts the gradient slice back at offset k along axis (after unsqueezing) before scattering into the input gradient.