资讯动态

CANN/pyasc自然指数函数文档

发布时间:2026/8/14 3:14:40 来源:尧图企业网站定制
asc.language.adv.exp【免费下载链接】pyasc本项目为Python用户提供算子编程接口支持在昇腾AI处理器上加速计算接口与Ascend C一一对应并遵守Python原生语法。项目地址: https://gitcode.com/cann/pyascasc.language.adv.exp(dst: LocalTensor, src: LocalTensor, count: int, taylor_expand_level: int, temp_buffer: LocalTensor | None None, is_reuse_source: bool False) → None按元素取自然指数用户可以选择是否使用泰勒展开公式进行计算。对应的Ascend C函数原型template typename T, uint8_t taylorExpandLevel, bool isReuseSource false __aicore__ inline void Exp(const LocalTensorT dstLocal, const LocalTensorT srcLocal, const LocalTensoruint8_t sharedTmpBuffer, const uint32_t calCount) template typename T, uint8_t taylorExpandLevel, bool isReuseSource false __aicore__ inline void Exp(const LocalTensorT dstLocal, const LocalTensorT srcLocal, const uint32_t calCount)参数说明taylor_expand_level泰勒展开项数项数为0表示不使用泰勒公式进行计算。项数太少时精度会有一定误差。项数越多精度相对而言更高但是性能会更差。is_reuse_source是否允许修改源操作数默认值为false。该参数仅在输入的数据类型为float时生效。dst目的操作数。src源操作数。temp_buffer临时缓存。count参与计算的元素个数。约束说明不支持源操作数与目的操作数地址重叠。不支持temp_buffer与源操作数和目的操作数地址重叠。操作数地址对齐要求请参见 《Ascend C算子开发接口》 中的“通用说明和约束-通用地址对齐约束”。调用示例pipe asc.Tpipe() tmp_que asc.TQue(asc.TPosition.VECCALC, 1) pipe.init_buffer(quetmp_que, num1, lenbuffer_size) # buffer_size 通过Host侧tiling参数获取 shared_tmp_buffer tmp_que.alloc_tensor(asc.uint8) # 输入tensor长度为1024算子输入的数据类型为half实际计算个数为512 asc.adv.exp(dst, src, count512, taylor_expand_level0, temp_buffershared_tmp_buffer)【免费下载链接】pyasc本项目为Python用户提供算子编程接口支持在昇腾AI处理器上加速计算接口与Ascend C一一对应并遵守Python原生语法。项目地址: https://gitcode.com/cann/pyasc创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

读完文章,也想定制专属网站?

尧图设计师 24 小时内与您沟通定制方案

免费获取报价