fp16_t【免费下载链接】opbase本项目是CANN算子库的基础框架库为算子提供公共依赖文件和基础调度能力。项目地址: https://gitcode.com/cann/opbase本章接口为预留接口后续有可能变更或废弃不建议开发者使用开发者无需关注。表 1接口列表接口定义功能说明tagFp16(void)fp16_t的默认构造函数且不带任何参数。tagFp16(const T value)fp16_t的构造函数且有一个可以是任何数据类型的参数。tagFp16(const bfloat16 value)fp16_t的构造函数且有一个bfloat16数据类型参数。tagFp16(const uint16_t uiVal)fp16_t的构造函数且有一个uint16_t数据类型参数。tagFp16(const tagFp16 fp)fp16_t的构造函数且有一个fp16_t数据类型参数拷贝构造函数。float()重写转换运算符以将fp16_t转换为floatfp32。bfloat16()重写转换运算符以将fp16_t转换为bfloat16。double()重写转换运算符以将fp16_t转换为doublefp64。int8_t()重写转换运算符以将fp16_t转换为int8_t。uint8_t()重写转换运算符以将fp16_t转换为uint8_t。int16_t()重写转换运算符以将fp16_t转换为int16_t。uint16_t()重写转换运算符以将fp16_t转换为uint16_t。int32_t()重写转换运算符以将fp16_t转换为int32_t。uint32_t()重写转换运算符以将fp16_t转换为uint32_t。int64_t()重写转换运算符以将fp16_t转换为int64_t。uint64_t()重写转换运算符以将fp16_t转换为uint64_t。bool()重写转换运算符以将fp16_t转换为bool。IsInf()判断fp16_t数值是不是无穷的正无穷返回1负无穷返回-1否则返回0。toFloat()将fp16_t转换为floatfp32。toDouble()将fp16_t转换为doublefp64。toInt8()将fp16_t转换为int8_t。toUInt8()将fp16_t转换为uint8_t。toInt16()将fp16_t转换为int16_t。toUInt16()将fp16_t转换为uint16_t。toInt32()将fp16_t转换为int32_t。toUInt32()将fp16_t转换为uint32_t。ExtractFP16(const uint16_t val, uint16_ts, int16_te, uint16_t *m)提取fp16_t对象的符号、指数和尾数。ReverseMan(bool negative, T *man)当符号位是负数计算尾数的补码。MinMan(const int16_t ea, Tma, const int16_t eb, Tmb)选择指数小于另一个指数的尾数右移。RightShift(T man, int16_t shift)尾数右移shift位。GetManSum(int16_t ea, const T ma, int16_t eb, const T mb)获取两个fp16_t数的尾数和T支持类型uint16_t/uint32_t/uint64_t。ManRoundToNearest(bool bit0, bool bit1, bool bitLeft, T man, uint16_t shift 0)将fp16_t或float尾数舍入为最接近的值。GetManBitLength(T man)获取浮点数尾数的位长度。isnan(op::fp16_t value)判断数值是不是无法表示(Not a Number)。【免费下载链接】opbase本项目是CANN算子库的基础框架库为算子提供公共依赖文件和基础调度能力。项目地址: https://gitcode.com/cann/opbase创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考