CANN/ops-math取余算子标量接口

CANN/ops-math取余算子标量接口

aclnnFmodScalar & aclnnInplaceFmodScalar

【免费下载链接】ops-math本项目是CANN提供的数学类基础计算算子库,实现网络在NPU上加速计算。项目地址: https://gitcode.com/cann/ops-math

功能说明

self和 host scalarother执行 Mod 取余计算:out = self - other * trunc(self / other)outshape 需要与self一致。

接口原型

aclnnStatus aclnnFmodScalarGetWorkspaceSize( const aclTensor* self, const aclScalar* other, aclTensor* out, uint64_t* workspaceSize, aclOpExecutor** executor); aclnnStatus aclnnFmodScalar( void* workspace, uint64_t workspaceSize, aclOpExecutor* executor, aclrtStream stream); aclnnStatus aclnnInplaceFmodScalarGetWorkspaceSize( aclTensor* selfRef, const aclScalar* other, uint64_t* workspaceSize, aclOpExecutor** executor); aclnnStatus aclnnInplaceFmodScalar( void* workspace, uint64_t workspaceSize, aclOpExecutor* executor, aclrtStream stream);

约束

  • selfout支持 ND,维度不超过 8。
  • aclnn 层支持 DOUBLE、BFLOAT16、FLOAT16、FLOAT32、INT32、INT64、INT8、UINT8 类型推导;AICore kernel 覆盖 BFLOAT16、FLOAT16、FLOAT32、INT32,其余类型走 AICPU fallback。BFLOAT16 仅在支持该数据类型的 NPU 平台上走 AICore。
  • outshape 必须等于selfshape。

样例

examples/test_aclnn_fmod_scalar.cpp

【免费下载链接】ops-math本项目是CANN提供的数学类基础计算算子库,实现网络在NPU上加速计算。项目地址: https://gitcode.com/cann/ops-math

创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考