mindspore_lite.Format

class mindspore_lite.Format[source]

The Format class defines the format of the Tensor in MindSpore Lite.

Currently, the following ‘Format’ are supported:

Definition

Description

Format.DEFAULT

default format.

Format.NCHW

Store tensor data in the order of batch N, channel C, height H and width W.

Format.NHWC

Store tensor data in the order of batch N, height H, width W and channel C.

Format.NHWC4

C-axis 4-byte aligned Format.NHWC .

Format.HWKC

Store tensor data in the order of height H, width W, kernel num K and channel C.

Format.HWCK

Store tensor data in the order of height H, width W, channel C and kernel num K.

Format.KCHW

Store tensor data in the order of kernel num K, channel C, height H and width W.

Format.CKHW

Store tensor data in the order of channel C, kernel num K, height H and width W.

Format.KHWC

Store tensor data in the order of kernel num K, height H, width W and channel C.

Format.CHWK

Store tensor data in the order of channel C, height H, width W and kernel num K.

Format.HW

Store tensor data in the order of height H and width W.

Format.HW4

w-axis 4-byte aligned Format.HW .

Format.NC

Store tensor data in the order of batch N and channel C.

Format.NC4

C-axis 4-byte aligned Format.NC .

Format.NC4HW4

C-axis 4-byte aligned and W-axis 4-byte aligned Format.NCHW .

Format.NCDHW

Store tensor data in the order of batch N, channel C, depth D, height H and width W.

Format.NWC

Store tensor data in the order of batch N, width W and channel C.

Format.NCW

Store tensor data in the order of batch N, channel C and width W.

Format.NDHWC

Store tensor data in the order of batch N, depth D, height H, width W and channel C.

Format.NC8HW8

C-axis 8-byte aligned and W-axis 8-byte aligned Format.NCHW .

Examples

>>> # Method 1: Import mindspore_lite package
>>> import mindspore_lite as mslite
>>> print(mslite.Format.NHWC)
Format.NHWC
>>> # Method 2: from mindspore_lite package import Format
>>> from mindspore_lite import Format
>>> print(Format.NHWC)
Format.NHWC