fn
unbind
→tuple of Tensorunbind(input: Tensor, dim: DimLike = ...)Remove dim and return a tuple of views along it.
Equivalent to [x.select(dim, i) for i in range(x.size(dim))] but
implemented as a single op. The resulting tensors share storage
with x.
Parameters
inputTensorSource tensor.
dimDimLike= ...Dimension to unbind.
Returns
tuple of Tensorinput.size(dim) views, each of rank input.ndim - 1.
Notes
The inverse operation is stack along the same dim. Useful
for unpacking batched sequences without copying.
Examples
>>> import lucid
>>> x = lucid.tensor([[1, 2], [3, 4]])
>>> a, b = lucid.unbind(x, dim=0)
>>> b
Tensor([3, 4])