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