ToOpDataType

Function Usage

Converts aclDataType to op::DataType.

aclDataType is the external data type of AscendCL. op::DataType is the internal data type defined by aclnn. In practice, the ge::DataType defined by GE is used.

Prototype

DataType ToOpDataType(aclDataType type)

Parameters

Parameter

Input/Output

Description

type

Input

aclDataType to be converted. The data type is converted to op::DataType.

aclDataType is defined as follows:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
typedef enum {
    ACL_DT_UNDEFINED = -1,  // Unknown data type (default)
    ACL_FLOAT = 0,
    ACL_FLOAT16 = 1,
    ACL_INT8 = 2,
    ACL_INT32 = 3,
    ACL_UINT8 = 4,
    ACL_INT16 = 6,
    ACL_UINT16 = 7,
    ACL_UINT32 = 8,
    ACL_INT64 = 9,
    ACL_UINT64 = 10,
    ACL_DOUBLE = 11,
    ACL_BOOL = 12,
    ACL_STRING = 13,
    ACL_COMPLEX64 = 16,
    ACL_COMPLEX128 = 17,
    ACL_BF16 = 27,
    ACL_INT4 = 29,
    ACL_UINT1 = 30,
    ACL_COMPLEX32 = 33,
} aclDataType;

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

Returns

op::DataType type.

Constraints

None

Example

1
2
3
4
// Obtain the DataType enumeration corresponding to ACL_FLOAT.
void Func() {
    DataType type = ToOpDataType(ACL_FLOAT);
}