mindspore.ops.Squeeze
- class mindspore.ops.Squeeze(axis=())[source]
Return the Tensor after deleting the dimension of size 1 in the specified axis.
Refer to
mindspore.ops.squeeze()
for more details.- Parameters
axis (Union[int, tuple(int)]) – Specifies the dimension indexes of shape to be removed, which will remove all the dimensions of size 1 in the given axis parameter. If specified, it must be int32 or int64. Default: ().
- Inputs:
input_x (Tensor) - The shape of tensor is \((x_1, x_2, ..., x_R)\).
- Outputs:
Tensor, the shape of tensor is \((x_1, x_2, ..., x_S)\).
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> input_x = Tensor(np.ones(shape=[3, 2, 1]), mindspore.float32) >>> squeeze = ops.Squeeze(2) >>> output = squeeze(input_x) >>> print(output) [[1. 1.] [1. 1.] [1. 1.]]