check_shape_rule

Description

Verifies shape of a tensor.

Prototype

def check_shape_rule(shape, min_dim=None, max_dim=None, max_shape_num=None)

Parameters

Parameter

Description

shape

Shape to check.

It is a group or list of ints that are greater than 0.

min_dim

Minimum dimension count. Defaults to DEFAULT_MIN_SHAPE_DIM, that is, 1.

max_dim

Maximum dimension count. Defaults to DEFAULT_MAX_SHAPE_DIM, that is, 8.

max_shape_num

Product of dimension sizes of the maximum shape.

Defaults to DEFAULT_MAX_SHAPE_NUM, that is, 200000000.

Returns

None

"RuntimeError" is thrown if the verification fails.

Restrictions

The dimension count of shape must be in the range [min_dim, max_dim].

Example

from tbe.common.utils import para_check 
para_check.check_shape_rule((32,64,64,3,54,32,21,12,33,32)) 

"RuntimeError" is thrown as the verification fails.