:nosearch: .. _op_ai_onnx_Squeeze-13: Squeeze - version 13 ==================== This page documents version **13** of operator **Squeeze**. See :doc:`Squeeze` for the latest version (since version 25). - **Domain**: ``ai.onnx`` - **Since version**: 13 Remove single-dimensional entries from the shape of a tensor. Takes an input ``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. **Inputs** - **data** (*T*): Tensors with at least max(dims) dimensions. - **axes** (*tensor(int64)*): List of integers indicating the dimensions to squeeze. Negative value means counting dimensions from the back. Accepted range is [-r, r-1] where r = rank(data). **Outputs** - **squeezed** (*T*): Reshaped tensor with same data as input. **Type Constraints** - **T**: Constrain input and output types to all tensor types. Allowed types: tensor(bfloat16), tensor(bool), tensor(complex128), tensor(complex64), tensor(double), tensor(float), tensor(float16), tensor(int16), tensor(int32), tensor(int64), tensor(int8), tensor(string), tensor(uint16), tensor(uint32), tensor(uint64), tensor(uint8). Examples -------- **test_cc_squeeze_all_singleton** .. code-block:: text Node: Squeeze(data, axes) -> (squeezed) .. code-block:: text Inputs: data: shape=(1, 2, 1, 3), dtype=float32 [[[[0., 1., 2.]], [[3., 4., 5.]]]] axes: shape=(0,), dtype=int64 [] Outputs: squeezed: shape=(2, 3), dtype=float32 [[0., 1., 2.], [3., 4., 5.]] **test_cc_squeeze_axes** .. code-block:: text Node: Squeeze(data, axes) -> (squeezed) .. code-block:: text Inputs: data: shape=(2, 1, 3, 1), dtype=float32 [[[[0.], [1.], [2.]]], [[[3.], [4.], [5.]]]] axes: shape=(2,), dtype=int64 [1, 3] Outputs: squeezed: shape=(2, 3), dtype=float32 [[0., 1., 2.], [3., 4., 5.]] **test_cc_squeeze_empty_axes_name** .. code-block:: text Node: Squeeze(data, "") -> (squeezed) .. code-block:: text Inputs: data: shape=(1, 2, 1, 3), dtype=float32 [[[[0., 1., 2.]], [[3., 4., 5.]]]] Outputs: squeezed: shape=(2, 3), dtype=float32 [[0., 1., 2.], [3., 4., 5.]] **test_cc_squeeze_no_axes_input** .. code-block:: text Node: Squeeze(data) -> (squeezed) .. code-block:: text Inputs: data: shape=(1, 2, 1, 3), dtype=float32 [[[[0., 1., 2.]], [[3., 4., 5.]]]] Outputs: squeezed: shape=(2, 3), dtype=float32 [[0., 1., 2.], [3., 4., 5.]] Differences with previous version (11) -------------------------------------- **SchemaDiff**: ``Squeeze`` (domain ``'ai.onnx'``) * old version: 11 * new version: 13 * breaking: **yes** **Breaking reasons:** * input 'axes' (added): at position 1; option=Single; type_str='tensor(int64)' * attribute 'axes' (removed): type=INTS; required=False **Inputs:** * [BREAKING] added 'axes': at position 1; option=Single; type_str='tensor(int64)' **Attributes:** * [BREAKING] removed 'axes': type=INTS; required=False **Type constraints:** * changed 'T': added types: ['tensor(bfloat16)'] **Documentation:** * line similarity: 0.80 (+1/-1 lines) .. code-block:: diff --- Squeeze v11 +++ Squeeze v13 @@ -1,5 +1,5 @@ Remove single-dimensional entries from the shape of a tensor. -Takes a parameter `axes` with a list of axes to squeeze. +Takes an input `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.