check_shape_size

Description

Checks whether the shape size (the product of all dimensions) exceeds the specified limit.

Prototype

def check_shape_size(shape, limit=SHAPE_SIZE_LIMIT+1)

Parameters

Parameter

Description

shape

Shape to check.

limit

Specified limit. Defaults to SHAPE_SIZE_LIMIT plus 1, where, SHAPE_SIZE_LIMIT = 2 ** 31 – 1.

Returns

None

Restrictions

If the shape size exceeds the specified limit, the message "RuntimeError" is thrown.

Example

from tbe.common.utils import para_check 
para_check.check_shape_size((32, 64, 64, 3))