Skip to content
fn

squeeze_op

→TensorImplPtr
int squeeze_op(const int & a, int dim)

Python wrappers

Public Python APIs implemented by this engine symbol.

Remove a single size-1 dimension.

Drops the axis at position dim, which must currently have size 1. Negative dim wraps relative to the input rank.

See Also

squeeze_all_op, unsqueeze_op.

Parameters

aTensorImplPtr
Input tensor with rank >= 1.
dimint
Axis to remove. Must satisfy -ndim <= dim < ndim and a.shape[dim] == 1.

Returns

TensorImplPtr

A view with rank ndim - 1.

Raises

IndexError
If dim is out of range.
ValueError
If the targeted dimension is not of size 1.