Squeeze#
Squeeze - 13#
Version
name: Squeeze (GitHub)
domain: main
since_version: 13
function: False
support_level: SupportType.COMMON
shape inference: True
This version of the operator has been available since version 13.
Summary
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
Between 1 and 2 inputs.
data (heterogeneous) - T: Tensors with at least max(dims) dimensions.
axes (optional, heterogeneous) - 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 (heterogeneous) - T: Reshaped tensor with same data as input.
Type Constraints
T in ( 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) ): Constrain input and output types to all tensor types.
Examples
squeeze
node = onnx.helper.make_node(
'Squeeze',
inputs=['x', 'axes'],
outputs=['y'],
)
x = np.random.randn(1, 3, 4, 5).astype(np.float32)
axes = np.array([0], dtype=np.int64)
y = np.squeeze(x, axis=0)
expect(node, inputs=[x, axes], outputs=[y],
name='test_squeeze')
squeeze_negative_axes
node = onnx.helper.make_node(
'Squeeze',
inputs=['x', 'axes'],
outputs=['y'],
)
x = np.random.randn(1, 3, 1, 5).astype(np.float32)
axes = np.array([-2], dtype=np.int64)
y = np.squeeze(x, axis=-2)
expect(node, inputs=[x, axes], outputs=[y],
name='test_squeeze_negative_axes')
Differences
0 | 0 | Remove single-dimensional entries from the shape of a tensor. | Remove single-dimensional entries from the shape of a tensor. |
1 | 1 | Takes a parameter axes with a list of axes to squeeze. |
|
2 | 2 | If axes is not provided, all the single dimensions will be removed from | If axes is not provided, all the single dimensions will be removed from |
3 | 3 | the shape. If an axis is selected with shape entry not equal to one, an error is raised. | the shape. If an axis is selected with shape entry not equal to one, an error is raised. |
4 | 4 |
|
|
5 | **Inputs** | ||
6 |
| ||
7 | Between 1 and 2 inputs. | ||
8 |
| ||
5 | 9 | **Attributes** |
|
6 |
| ||
10 | Tensors with at least max(dims) dimensions. | ||
7 | 11 | * **axes**: |
|
8 | 12 | List of integers indicating the dimensions to squeeze. Negative | List of integers indicating the dimensions to squeeze. Negative |
9 | 13 | value means counting dimensions from the back. Accepted range is | value means counting dimensions from the back. Accepted range is |
10 | 14 | [-r, r-1] where r = rank(data). | [-r, r-1] where r = rank(data). |
11 | 15 |
|
|
12 | **Inputs** | ||
13 |
| ||
14 | * **data** (heterogeneous) - **T**: | ||
15 | Tensors with at least max(dims) dimensions. | ||
16 |
| ||
17 | 16 | **Outputs** | **Outputs** |
18 | 17 |
|
|
19 | 18 | * **squeezed** (heterogeneous) - **T**: | * **squeezed** (heterogeneous) - **T**: |
20 | 19 | Reshaped tensor with same data as input. | Reshaped tensor with same data as input. |
21 | 20 |
|
|
22 | 21 | **Type Constraints** | **Type Constraints** |
23 | 22 |
|
|
24 | 23 | * **T** in ( | * **T** in ( |
24 | tensor(bfloat16), | ||
25 | 25 | tensor(bool), | tensor(bool), |
26 | 26 | tensor(complex128), | tensor(complex128), |
27 | 27 | tensor(complex64), | tensor(complex64), |
28 | 28 | tensor(double), | tensor(double), |
29 | 29 | tensor(float), | tensor(float), |
30 | 30 | tensor(float16), | tensor(float16), |
31 | 31 | tensor(int16), | tensor(int16), |
32 | 32 | tensor(int32), | tensor(int32), |
33 | 33 | tensor(int64), | tensor(int64), |
34 | 34 | tensor(int8), | tensor(int8), |
35 | 35 | tensor(string), | tensor(string), |
36 | 36 | tensor(uint16), | tensor(uint16), |
37 | 37 | tensor(uint32), | tensor(uint32), |
38 | 38 | tensor(uint64), | tensor(uint64), |
39 | 39 | tensor(uint8) | tensor(uint8) |
40 | 40 | ): | ): |
41 | 41 | Constrain input and output types to all tensor types. | Constrain input and output types to all tensor types. |
Squeeze - 11#
Version
name: Squeeze (GitHub)
domain: main
since_version: 11
function: False
support_level: SupportType.COMMON
shape inference: True
This version of the operator has been available since version 11.
Summary
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.
Attributes
axes: 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).
Inputs
data (heterogeneous) - T: Tensors with at least max(dims) dimensions.
Outputs
squeezed (heterogeneous) - T: Reshaped tensor with same data as input.
Type Constraints
T in ( 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) ): Constrain input and output types to all tensor types.
Differences
0 | 0 | Remove single-dimensional entries from the shape of a tensor. | Remove single-dimensional entries from the shape of a tensor. |
1 | 1 | Takes a parameter axes with a list of axes to squeeze. | Takes a parameter axes with a list of axes to squeeze. |
2 | 2 | If axes is not provided, all the single dimensions will be removed from | If axes is not provided, all the single dimensions will be removed from |
3 | 3 | the shape. If an axis is selected with shape entry not equal to one, an error is raised. | the shape. If an axis is selected with shape entry not equal to one, an error is raised. |
4 | 4 |
|
|
5 | 5 | **Attributes** | **Attributes** |
6 | 6 |
|
|
7 | 7 | * **axes**: | * **axes**: |
8 | 8 | List of non-negative integers, indicate the dimensions to squeeze. |
|
9 | value means counting dimensions from the back. Accepted range is | ||
10 | [-r, r-1] where r = rank(data). | ||
9 | 11 |
|
|
10 | 12 | **Inputs** | **Inputs** |
11 | 13 |
|
|
12 | 14 | * **data** (heterogeneous) - **T**: | * **data** (heterogeneous) - **T**: |
13 | 15 | Tensors with at least max(dims) dimensions. | Tensors with at least max(dims) dimensions. |
14 | 16 |
|
|
15 | 17 | **Outputs** | **Outputs** |
16 | 18 |
|
|
17 | 19 | * **squeezed** (heterogeneous) - **T**: | * **squeezed** (heterogeneous) - **T**: |
18 | 20 | Reshaped tensor with same data as input. | Reshaped tensor with same data as input. |
19 | 21 |
|
|
20 | 22 | **Type Constraints** | **Type Constraints** |
21 | 23 |
|
|
22 | 24 | * **T** in ( | * **T** in ( |
23 | 25 | tensor(bool), | tensor(bool), |
24 | 26 | tensor(complex128), | tensor(complex128), |
25 | 27 | tensor(complex64), | tensor(complex64), |
26 | 28 | tensor(double), | tensor(double), |
27 | 29 | tensor(float), | tensor(float), |
28 | 30 | tensor(float16), | tensor(float16), |
29 | 31 | tensor(int16), | tensor(int16), |
30 | 32 | tensor(int32), | tensor(int32), |
31 | 33 | tensor(int64), | tensor(int64), |
32 | 34 | tensor(int8), | tensor(int8), |
33 | 35 | tensor(string), | tensor(string), |
34 | 36 | tensor(uint16), | tensor(uint16), |
35 | 37 | tensor(uint32), | tensor(uint32), |
36 | 38 | tensor(uint64), | tensor(uint64), |
37 | 39 | tensor(uint8) | tensor(uint8) |
38 | 40 | ): | ): |
39 | 41 | Constrain input and output types to all tensor types. | Constrain input and output types to all tensor types. |
Squeeze - 1#
Version
name: Squeeze (GitHub)
domain: main
since_version: 1
function: False
support_level: SupportType.COMMON
shape inference: True
This version of the operator has been available since version 1.
Summary
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.
Attributes
axes: List of non-negative integers, indicate the dimensions to squeeze.
Inputs
data (heterogeneous) - T: Tensors with at least max(dims) dimensions.
Outputs
squeezed (heterogeneous) - T: Reshaped tensor with same data as input.
Type Constraints
T in ( 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) ): Constrain input and output types to all tensor types.