CANN/pyasc双曲正切函数API
asc.language.adv.tanh【免费下载链接】pyasc本项目为Python用户提供算子编程接口支持在昇腾AI处理器上加速计算接口与Ascend C一一对应并遵守Python原生语法。项目地址: https://gitcode.com/cann/pyascasc.language.adv.tanh(dst: LocalTensor, src: LocalTensor, count: int | None None, temp_buffer: LocalTensor | None None, is_reuse_source: bool False) → None按元素做逻辑回归Tanh。对应的Ascend C函数原型template typename T, bool isReuseSource false __aicore__ inline void Tanh(const LocalTensorT dstTensor, const LocalTensorT srcTensor, const LocalTensoruint8_t sharedTmpBuffer, const uint32_t calCount)template typename T, bool isReuseSource false __aicore__ inline void Tanh(const LocalTensorT dstTensor, const LocalTensorT srcTensor, const LocalTensoruint8_t sharedTmpBuffer)template typename T, bool isReuseSource false __aicore__ inline void Tanh(const LocalTensorT dstTensor, const LocalTensorT srcTensor, const uint32_t calCount)template typename T, bool isReuseSource false __aicore__ inline void Tanh(const LocalTensorT dstTensor, const LocalTensorT srcTensor)参数说明is_reuse_source是否允许修改源操作数。dst目的操作数。类型为LocalTensor支持的TPosition为VECIN/VECCALC/VECOUT。src源操作数。类型为LocalTensor支持的TPosition为VECIN/VECCALC/VECOUT。源操作数的数据类型需要与目的操作数保持一致。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.Tanh(dst, src, count512, temp_buffershared_tmp_buffer)【免费下载链接】pyasc本项目为Python用户提供算子编程接口支持在昇腾AI处理器上加速计算接口与Ascend C一一对应并遵守Python原生语法。项目地址: https://gitcode.com/cann/pyasc创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考