Skip to content

运算符重载

产品支持情况​

  • Ascend 950PR&950DT系列产品:支持
  • Atlas A3系列产品:支持
  • Atlas A2系列产品:支持
  • Atlas 200I/500 A2推理产品:不支持
  • Atlas推理系列产品AI Core:不支持
  • Atlas推理系列产品Vector Core:不支持
  • Atlas训练系列产品:不支持

功能说明​

重载运算符(),内部实现为调用Crd2Idx接口,将多维坐标(Coordinate)通过布局(Layout)转换为内存位置索引(Index)。

函数原型​

C++
template <typename CoordType>
__aicore__ inline constexpr auto operator()(const CoordType& coord) const {}

参数说明​

参数名

输入/输出

描述

coord

输入

Coord结构类型,用于表示张量在不同维度上的坐标值。

返回值说明​

返回根据Coordinate信息转换之后的索引值。

约束说明​

无

调用示例​

C++
...
auto layout = AscendC::MakeLayout(shape, stride);
auto index = layout(coord);

免责声明:本站内容由 asc-devkit 仓 master 分支自动编译生成,属于持续开发版本,可能存在缺陷,仅供预览与参考。如需稳定及商用资料,请查阅官方 昇腾社区。