Lowest
产品支持情况
- Ascend 950PR/Ascend 950DT:支持
- Atlas A3 训练系列产品/Atlas A3 推理系列产品:不支持
- Atlas A2 训练系列产品/Atlas A2 推理系列产品:不支持
- Atlas 200I/500 A2 推理产品:不支持
- Atlas 推理系列产品AI Core:不支持
- Atlas 推理系列产品Vector Core:不支持
- Atlas 训练系列产品:不支持
功能说明
头文件路径为:"basic_api/kernel_operator_limits_intf.h"。
返回指定数据类型的最低有限值,即满足无其他有限值y符合y < x的有限值x。
函数原型
标量接口,返回值为标量:
C++constexpr __aicore__ static inline T Lowest()矢量接口,为dstLocal前count个元素赋最低有限值:
C++__aicore__ static inline void Lowest(const LocalTensor<T>& dstLocal, uint32_t count)
参数说明
表1 参数说明
| 参数名 | 输入/输出 | 描述 |
|---|---|---|
| dstLocal | 输出 | 目的操作数。 类型为LocalTensor,支持的TPosition为VECIN/VECCALC/VECOUT。 LocalTensor的起始地址需要32字节对齐。 |
| count | 输入 | 输入数据元素个数。 |
数据类型
针对Ascend 950PR/Ascend 950DT,支持的数据类型为:int8_t、uint8_t、int16_t、uint16_t、half、bfloat16_t、int32_t、uint32_t、float。
返回值说明
标量接口返回值为对应数据类型的最低有限值。
矢量接口无返回值。
表 2 Lowest各数据类型输出
| 数据类型 | 十进制数 | 二进制各bit位 |
|---|---|---|
| uint8_t | 0 | 0000 0000 |
| int8_t | -128 | 1000 0000 |
| uint16_t | 0 | 0000 0000 0000 0000 |
| int16_t | -32768 | 1000 0000 0000 0000 |
| half | -65504 | 1 11110 1111111111 |
| bfloat16_t | -3.4e+38 | 1 11111110 1111111 |
| uint32_t | 0 | 0000 0000 0000 0000 0000 0000 0000 0000 |
| int32_t | -2147483648 | 1000 0000 0000 0000 0000 0000 0000 0000 |
| float | -3.4e+38 | 1 11111110 11111111111111111111111 |
约束说明
标量接口无约束,矢量接口使用duplicate填充前count个元素赋最低有限值,参照Memory矢量计算下的数据填充接口duplicate约束。
调用示例
标量接口:
C++int32_t value = AscendC::NumericLimits<int32_t>::Lowest();矢量接口:
C++AscendC::NumericLimits<int32_t>::Lowest(dstLocal, 256);// 返回256个int32_t类型的最低有限值