aclnnLogSoftmax
支持的产品型号
- Atlas 推理系列产品。
- Atlas 训练系列产品。
- Atlas A2训练系列产品/Atlas 800I A2推理产品。
接口原型
每个算子分为undefined,必须先调用“aclnnLogSoftmaxGetWorkspaceSize”接口获取计算所需workspace大小以及包含了算子计算流程的执行器,再调用“aclnnLogSoftmax”接口执行计算。
aclnnStatus aclnnLogSoftmaxGetWorkspaceSize(const aclTensor* self, int64_t dim, aclTensor* out, uint64_t* workspaceSize, aclOpExecutor** executor)
aclnnStatus aclnnLogSoftmax(void* workspace, uint64_t workspaceSize, aclOpExecutor *executor, aclrtStream stream)
功能描述:
算子功能:对输入张量计算logsoftmax值
计算公式:
aclnnLogSoftmaxGetWorkspaceSize
参数说明:
self(aclTensor*, 计算输入):数据类型支持FLOAT16、FLOAT32、DOUBLE、BFLOAT16(仅Atlas A2训练系列产品/Atlas 800I A2推理产品支持),支持undefined,undefined支持ND。
dim(int64_t,计算输入):需要做logsoftmax的轴,数据类型INT64。
out(aclTensor*, 计算输出):数据类型支持FLOAT16、FLOAT32、DOUBLE、BFLOAT16(仅Atlas A2训练系列产品/Atlas 800I A2推理产品支持),支持undefined,且数据类型是self可转化的数据类型。undefined支持ND。输出shape应该与输入shape一致。
workspaceSize(uint64_t*, 出参):返回需要在Device侧申请的workspace大小。
executor(aclOpExecutor**, 出参):返回op执行器,包含了算子计算流程。
返回值:
aclnnStatus:返回状态码,具体参见undefined。
aclnnLogSoftmax
参数说明:
workspace(void*, 入参):在Device侧申请的workspace内存地址。
workspaceSize(uint64_t, 入参):在Device侧申请的workspace大小,由第一段接口aclnnLogSoftmaxGetWorkspaceSize获取。
executor(aclOpExecutor*, 入参):op执行器,包含了算子计算流程。
stream(aclrtStream, 入参):指定执行任务的 AscendCL Stream流。
返回值:
aclnnStatus:返回状态码,具体参见undefined。
约束与限制
无。
调用示例
示例代码如下,仅供参考,具体编译和执行过程请参考undefined。