Python wrappers
Public Python APIs implemented by this engine symbol.Insert a new size-1 dimension at a given position.
The new axis is added before position dim in the output, so the output
rank is ndim + 1. Negative dim wraps relative to the output rank
(so dim = -1 inserts before the last existing dimension).
See Also
squeeze_op, reshape_op.
Parameters
aTensorImplPtrInput tensor.
dimintInsertion position. Must satisfy
-(ndim + 1) <= dim <= ndim.Returns
TensorImplPtrA view with rank ndim + 1 and a size-1 dimension inserted at dim.
Raises
IndexErrorIf
dim is out of range.Examples
A length-5 1-D tensor unsqueezed at dim=0 becomes a (1, 5) view;
unsqueezed at dim=1 becomes a (5, 1) view.