squeeze_shape

Description

Removes dimensions sized 1 from the shape of a tensor.

For example, if shape (1, 2, 3, 4) of tensor a is passed to the call to this API, shape (2, 3, 4) is returned.

Prototype

def squeeze_shape(shape)

Parameters

Parameter

Description

shape

Tensor shape.

Returns

The result shape with dimensions sized 1 removed.

Restrictions

None

Example

from tbe.common.utils import shape_util 
shape = shape_util.squeeze_shape([2,1,3,1,4]) 

Return: [2,3,4].