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 detail.

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.]]