是不是也可以使用bangc算子写一个算子进行类型转换?
cnrtCastDataType
cnrtRet_t cnrtCastDataType(void *src_addr, cnrtDataType_t
src_data_type, void *dst_addr, cnrt‑
DataType_t dst_data_type, int data_num,
cnrtQuantizedParam_t param)
Caststhedatatypefromsourceaddresstodestinationaddressdependon
param.
Iftheparamisnull,noneedquantized,supportthecastdatatype: float32‑
>float16, float32‑>uint8, int64‑>float16, float16‑>float32, float16‑>uint8,
uint8‑>float32, uint8‑>float16, float32‑>float32
If the parm is not null, need quantized, support the case data type:
float32‑>float16, float32‑>int16, float32‑>int8, float32‑>int32, int32‑
>float32, float16‑>int16, int16‑>float32, int8‑>float32, float32‑>float32
Parameters
• src_addr[in]: A pointer to source address.
• src_data_type[in]: The type of source data.
• dst_addr[out]: A pointer to destination address.
• dst_data_type[in]: The type of destination data.
• data_num[in]: The number of need cast data.
• param[in]: A pointer to cnrtQuantizedParam_t.
Return Value
• CNRT_RET_SUCCESS:Thefunctionendsnormally. Otherwise, theerror
code is returned.
可参考cnrt接口
请登录后评论