CANN/atvc SinhCustom算子样例

📅 2026/7/10 14:55:31 👁️ 阅读次数 📝 编程学习
CANN/atvc SinhCustom算子样例

【免费下载链接】atvcATVC(Ascend C Templates for Vector Compute),是为基于Ascend C开发的典型Vector算子封装的一系列模板头文件的集合,可帮助用户快速开发典型Vector算子。项目地址: https://gitcode.com/cann/atvc

SinhCustom算子样例

概述

样例概述:本样例介绍了如何利用ATVC实现临时Tensor参与计算的SinhCustom单算子并完成算子验证

  • 算子功能:sinh
  • 使用的ATVC模板:Elementwise
  • 调用方式:Kernel直调

样例支持AI处理器型号

  • Ascend 910C
  • Ascend 910B

算子描述

SinhCustom算子数学计算公式:$y = \frac{\exp(x) - \exp(-x)}{2}$

SinhCustom算子规格:

算子类型(OpType)SinhCustom
算子输入
nameshapedata typeformat
x8 * 2048floatND
算子输出
y8 * 2048floatND
核函数名SinhCustom

目录结构

文件名描述
sinh_custom.cppSinhCustom算子代码实现以及调用样例

算子运行

在ascendc-api-adv代码仓目录下执行:

cd ./ops_templates/atvc/examples bash run_examples.sh sinh_custom

【免费下载链接】atvcATVC(Ascend C Templates for Vector Compute),是为基于Ascend C开发的典型Vector算子封装的一系列模板头文件的集合,可帮助用户快速开发典型Vector算子。项目地址: https://gitcode.com/cann/atvc

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