CANN/asc-devkit: Layout.GetStride方法
GetStride【免费下载链接】asc-devkit本项目是CANN 推出的昇腾AI处理器专用的算子程序开发语言原生支持C和C标准规范主要由类库和语言扩展层构成提供多层级API满足多维场景算子开发诉求。项目地址: https://gitcode.com/cann/asc-devkit产品支持情况Ascend 950PR/Ascend 950DT不支持Atlas A3 训练系列产品/Atlas A3 推理系列产品支持Atlas A2 训练系列产品/Atlas A2 推理系列产品支持Atlas 200I/500 A2 推理产品不支持Atlas 推理系列产品AI Core不支持Atlas 推理系列产品Vector Core不支持Atlas 训练系列产品不支持功能说明返回描述内存访问步长的Stride对象与Shape的维度信息一一对应。函数原型__aicore__ inline constexpr decltype(auto) GetStride() {} __aicore__ inline constexpr decltype(auto) GetStride() const {}参数说明无返回值说明描述内存访问步长的Stride对象Stride结构类型Std::tuple类型的别名定义如下template typename... Strides using Stride Std::tupleStrides...;约束说明无调用示例// 初始化Layout数据结构获取对应数值 AscendC::Shapeint,int,int shape AscendC::MakeShape(10, 20, 30); AscendC::Strideint,int,int stride AscendC::MakeStride(1, 100, 200); AscendC::LayoutAscendC::Shapeint, int, int, AscendC::Strideint, int, int layoutInit(shape, stride); int value AscendC::Std::get0(layoutInit.GetStride()); // value 1 value AscendC::Std::get1(layoutInit.GetStride()); // value 100 value AscendC::Std::get2(layoutInit.GetStride()); // value 200【免费下载链接】asc-devkit本项目是CANN 推出的昇腾AI处理器专用的算子程序开发语言原生支持C和C标准规范主要由类库和语言扩展层构成提供多层级API满足多维场景算子开发诉求。项目地址: https://gitcode.com/cann/asc-devkit创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考