终极解决Yaak插件依赖冲突:npm包版本强制解析完整指南
·
hlog
产品支持情况
- Ascend 950PR/Ascend 950DT:支持
- Atlas A3 训练系列产品/Atlas A3 推理系列产品:不支持
- Atlas A2 训练系列产品/Atlas A2 推理系列产品:不支持
- Atlas 200I/500 A2 推理产品:不支持
- Atlas 推理系列产品AI Core:不支持
- Atlas 推理系列产品Vector Core:不支持
- Atlas 训练系列产品:不支持
功能说明
获取以e为底,输入数据的对数。

函数原型
inline half hlog(half x)
参数说明
表1 参数说明
| 参数名 | 输入/输出 | 描述 |
|---|---|---|
| x | 输入 | 源操作数。 |
返回值说明
以e为底的x的对数。本接口受全局饱和寄存器的影响,特殊值如下:
| x值 | 非饱和模式返回值 | 饱和模式返回值 |
|---|---|---|
| ±0 | -inf | -ASCRT_MAX_NORMAL_FP16 |
| nan | nan | 0 |
| inf | inf | ASCRT_MAX_NORMAL_FP16 |
| -inf | nan | 0 |
| x<0 | nan | 0 |
约束说明
无
需要包含的头文件
使用half类型接口需要包含"simt_api/asc_fp16.h"头文件。
#include "simt_api/asc_fp16.h"
调用示例
-
SIMT编程场景:
__global__ __launch_bounds__(1024) void KernelLog(half* dst, half* x) { int idx = threadIdx.x + blockIdx.x * blockDim.x; dst[idx] = hlog(x[idx]); } -
SIMD与SIMT混合编程场景:
__simt_vf__ __launch_bounds__(1024) inline void KernelLog(__gm__ half* dst, __gm__ half* x) { int idx = threadIdx.x + blockIdx.x * blockDim.x; dst[idx] = hlog(x[idx]); }
更多推荐



所有评论(0)