openvino.runtime.opset2.squeeze(data: Node | int | float | ndarray, axes: Node | int | float | ndarray, name: str | None = None) Node#

Perform squeeze operation on input tensor.

  • data – The node with data tensor.

  • axes – List of non-negative integers, indicate the dimensions to squeeze. One of: input node or array.

  • name – Optional new name for output node.


The new node performing a squeeze operation on input tensor.

Remove single-dimensional entries from the shape of a tensor. Takes a parameter axes with a list of axes to squeeze. If axes is not provided, all the single dimensions will be removed from the shape. If an axis is selected with shape entry not equal to one, an error is raised.

For example:

Inputs: tensor with shape [1, 2, 1, 3, 1, 1], axes=[2, 4]

Result: tensor with shape [1, 2, 3, 1]