check_reduce_need_refine

Description

Checks whether an axis can be reduced.

Prototype

def check_reduce_need_refine(shape, reduce_axis, keep_dims)

Parameters

Parameter

Description

shape

Shape.

reduce_axis

An int or a tuple or list of ints, for the axes to reduce.

keep_dims

A bool, specifying whether to retain reduced dimensions.

Returns

False if reduce_axis is 1; True otherwise.

Restrictions

None

Example

from tbe.common.utils import shape_util 
shape_util.check_reduce_need_refine((1,32,32,3), 0, True) 

Checks whether shape (1,32,32,3) can be reduced. Returns False, indicating reduce supported.