axis_check

Description

Verifies axis and returns the dimension sizes sorted in ascending order with negative sizes wrapped to positive.

Prototype

def axis_check(shape_len, axis):

Parameters

Parameter

Description

shape_len

Shape length.

axis

An int or an array of ints, for the axes.

A negative axis is interpreted as indexing from the end.

Must be within the axis range of shape_len.

Returns

A dimension size or dimension sizes sorted in ascending order with negative sizes wrapped to positive

Restrictions

None

Example

from tbe.common.utils import shape_util 
shape_util.axis_check(5, -1) 

Return: 4.