当前位置: 首页 > news >正文

CANN/ATVOSS乘法运算API文档

Mul

【免费下载链接】atvossATVOSS(Ascend C Templates for Vector Operator Subroutines)是一套基于Ascend C开发的Vector算子库,致力于为昇腾硬件上的Vector类融合算子提供极简、高效、高性能、高拓展的编程方式。项目地址: https://gitcode.com/cann/atvoss

功能说明

乘法运算,支持张量*张量,张量*标量,标量*张量。

所属头文件链接

/include/operators/math_expression.h

函数原型

template<typename T, typename U> struct OpMul : BinaryOp<T, U> template<typename T, typename U> __host_aicore__ constexpr auto operator*(Expression<T> lhs, Expression<U> rhs) template<typename T, typename U> __host_aicore__ constexpr auto operator*(Expression<T> lhs, U &&rhs) template<typename T, typename U> __host_aicore__ constexpr auto operator*(T &&lhs, Expression<U> rhs)

参数说明

参数名称参数类型输入/输出数据类型参数说明默认值
T模板参数输入NA乘法左操作数数据类型NA
U模板参数输入NA乘法右操作数数据类型NA
lhs函数形参输入NA乘法左操作数,当类型是Expression<T>时,是张量,当类型是T时,是标量NA
rhs函数形参输入NA乘法右操作数,当类型是Expression<U>时,是张量,当类型是U时,是标量NA

返回值说明

返回值数据类型返回值说明
Expression >返回一个OpMul的表达式

约束说明

不支持广播

使用示例

template <typename InputDtype, typename OutputDtype> struct Config { struct Compute { template <template <typename> class Tensor> __host_aicore__ constexpr auto Compute() const { auto in1 = Atvoss::PlaceHolder<1, Tensor<InputDtype>, Atvoss::ParamUsage::IN>(); auto in2 = Atvoss::PlaceHolder<2, Tensor<InputDtype>, Atvoss::ParamUsage::IN>(); auto out = Atvoss::PlaceHolder<3, Tensor<OutputDtype>, Atvoss::ParamUsage::OUT>(); // 🔥🔥🔥 使用示例 🔥🔥🔥 return (out = in1 * in2); // 🔥🔥🔥 使用示例 🔥🔥🔥 }; }; }; template <typename InputDtype, typename OutputDtype> struct Config { struct Compute { template <template <typename> class Tensor> __host_aicore__ constexpr auto Compute() const { auto in = Atvoss::PlaceHolder<1, Tensor<InputDtype>, Atvoss::ParamUsage::IN>(); auto scalar = Atvoss::PlaceHolder<2, InputDtype, Atvoss::ParamUsage::IN>(); auto out = Atvoss::PlaceHolder<3, Tensor<OutputDtype>, Atvoss::ParamUsage::OUT>(); // 🔥🔥🔥 使用示例 🔥🔥🔥 return (out = in * scalar); // 🔥🔥🔥 使用示例 🔥🔥🔥 }; }; }; template <typename InputDtype, typename OutputDtype> struct Config { struct Compute { template <template <typename> class Tensor> __host_aicore__ constexpr auto Compute() const { auto in = Atvoss::PlaceHolder<1, Tensor<InputDtype>, Atvoss::ParamUsage::IN>(); auto scalar = Atvoss::PlaceHolder<2, InputDtype, Atvoss::ParamUsage::IN>(); auto out = Atvoss::PlaceHolder<3, Tensor<OutputDtype>, Atvoss::ParamUsage::OUT>(); // 🔥🔥🔥 使用示例 🔥🔥🔥 return (out = scalar * in); // 🔥🔥🔥 使用示例 🔥🔥🔥 }; }; };

【免费下载链接】atvossATVOSS(Ascend C Templates for Vector Operator Subroutines)是一套基于Ascend C开发的Vector算子库,致力于为昇腾硬件上的Vector类融合算子提供极简、高效、高性能、高拓展的编程方式。项目地址: https://gitcode.com/cann/atvoss

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

http://www.jsqmd.com/news/783620/

相关文章:

  • 2026年北京消防排烟风机源头厂家深度选购指南|深胜博实业全线3CF认证 - 优质企业观察收录
  • 2026年北京超高层消防排烟风机方案:深胜博实业如何打破价格战陷阱 - 优质企业观察收录
  • 京东E卡回收哪里靠谱?亲测体验 - 抖抖收
  • 苏州高端定制西装指南:四家门店品牌详解 - 生活测评君
  • 弘一法师经典名句详解|送给迷茫焦虑、内耗纠结的年轻人
  • 天津波英废旧物资回收:武清区废铝废钢回收电话多少 - LYL仔仔
  • CANN计数器和缓冲约束
  • 从设备树到CAN总线:在RK3399开发板上用SPI驱动MCP2515的保姆级避坑指南
  • 2026年3月行业内正规的净化工程施工推荐分析,可定制化满足不同净化需求 - 品牌推荐师
  • CANN/hcomm HCCL通信管理器API
  • 【山东大学主办、EI稳定检索】第六届精密仪器与光学工程国际学术会议(PIOE 2026)
  • 湖北肖氏景观工程:阳新水泥制品加工怎么联系 - LYL仔仔
  • CANN/pypto双曲余弦函数
  • 代码 + Markdown知识库
  • CCAA审核员可以挂靠吗? - 众智商学院官方
  • 温岭市大溪致翔机械设备租赁:浙江吊车租赁推荐几家 - LYL仔仔
  • CANN/shmem Root Info工具指南
  • AGI赋能物联网:从数据管道到智能体网络的范式革命
  • 虚拟机创建及 Linux 系统安装
  • 2026年5月成都GEO优化服务商盘点:8家机构参考测评与选型分析 - 速递信息
  • WebSocket URL 配置记录
  • CANN/ops-nn LeakyReLU激活函数
  • CANN/hccl框架集成指南
  • 支付宝立减金套装是什么?可以回收吗? - 圆圆收
  • CANN/HCOMM拓扑层级类型查询
  • CANN/torchtitan-npu指标与调试指南
  • HarmonyOS 6 ArkUI 运动路径动画(motionPath)使用文档
  • 长期项目使用Taotoken按Token计费带来的成本可控性体验
  • JVM 深度调优实战:从 JDK 8 到 JDK 21 的演进与中间件落地
  • cpu 系统调用热点 中断 调度队列 - 小镇