Implementing kernel
C++ engine symbols that back this Python API.Inverse of flatten — split a single dim into a tuple of dims.
Replaces input's dim-th axis with the sequence sizes,
whose product must equal input.size(dim). At most one entry of
sizes may be -1 (inferred).
Parameters
inputTensorSource tensor.
dimintDimension to unflatten.
sizessequence of intTarget sizes for the new dims.
Returns
TensorTensor with one extra dimension (or more) where dim used to
be.
Notes
Built on reshape, so the result is a view of input on
the CPU and a copy on metal.
Examples
>>> import lucid
>>> x = lucid.zeros(2, 12)
>>> lucid.unflatten(x, dim=1, sizes=(3, 4)).shape
(2, 3, 4)