ToAclFormat

Function Usage

Converts op::Format to aclFormat.

aclFormat is the external data format of Ascend Computing Language (AscendCL). op::Format is the internal data format defined by aclnn. In practice, the ge::Format defined by GE is used.

Prototype

aclFormat ToAclFormat(Format format)

Parameters

Parameter

Input/Output

Description

format

Input

op::Format to be converted. The converted aclFormat is defined as follows:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
typedef enum {
    ACL_FORMAT_UNDEFINED = -1,
    ACL_FORMAT_NCHW = 0,
    ACL_FORMAT_NHWC = 1,
    ACL_FORMAT_ND = 2,
    ACL_FORMAT_NC1HWC0 = 3,
    ACL_FORMAT_FRACTAL_Z = 4,
    ACL_FORMAT_NC1HWC0_C04 = 12,
    ACL_FORMAT_HWCN = 16,
    ACL_FORMAT_NDHWC = 27,
    ACL_FORMAT_FRACTAL_NZ = 29,
    ACL_FORMAT_NCDHW = 30,
    ACL_FORMAT_NDC1HWC0 = 32,
    ACL_FRACTAL_Z_3D = 33,
    ACL_FORMAT_NC = 35,
    ACL_FORMAT_NCL = 47,
} aclFormat;

The definition of the aclFormat is provided by AscendCL. For details, see aclFormat in Application Development APIs.

Returns

aclFormat type.

Constraints

None

Example

1
2
3
4
// Obtain the aclFormat enumeration corresponding to FORMAT_ND.
void Func() {
    aclFormat format = ToAclFormat(FORMAT_ND);
}