axis_transform_5d

Description

Transforms a 4D axis to a 5HD one.

Prototype

def axis_transform_5d(axis, data_format)

Parameters

Parameter

Description

axis

An int for the axis.

data_format

A string for the format, either NCHW or NHWC. If it is set to other formats, the axis itself is returned.

Returns

A 5HD axis

Restrictions

data_format can only be NCHW or NHWC.

Example

from tbe.common.utils import shape_util 
shape_util.axis_transform_5d(3, "NCHW") 

Transforms axis 3 corresponding to W to the corresponding 5HD value, that is, 3.