将op::DataType转换为对应的aclDataType。
aclDataType为AscendCL(Ascend Computing Language)对外提供的数据类型,op::DataType为aclnn定义的内部数据类型,实际使用的是GE定义的ge::DataType。
aclDataType ToAclDataType(DataType type)
参数 |
输入/输出 |
说明 |
---|---|---|
type |
输入 |
待转换的op::DataType。转换后的aclDataType定义如下: typedef enum { ACL_DT_UNDEFINED = -1, //未知数据类型,默认值 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; aclDataType定义由AscendCL提供,具体参见aclDataType章节。 |
返回aclDataType类型。
无
// 获取DT_FLOAT对应的aclDataType枚举 void Func() { aclDataType type = ToAclDataType(DT_FLOAT); }