| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
docs(arange): 修正 docs/ 下示例代码相对路径错误 Co-authored-by: chensi79<chensi79@huawei.com> # message auto-generated for no-merge-commit merge: !4400 merge fix/issue-2466-doc-relative-path into master docs(arange): 修正 docs/ 下示例代码相对路径错误 Created-by: chensi79 Commit-by: chensi79 Merged-by: cann-robot Description: Closes #2466 ## 摘要 修正 experimental/math/{arange,acosh,mod}/docs/ 下 md 文档引用示例代码时的相对路径错误。 文档位于 docs/ 子目录,引用 examples/xxx.cpp 会解析为 docs/examples/(不存在),导致读者无法按路径找到示例源码。修正为 ../examples/ 前缀,与文档所在目录层级匹配。 ## 涉及文件 - experimental/math/arange/docs/aclnnArange.md:230 — examples/ → ../examples/(Issue #2466 报告的主问题) - experimental/math/acosh/docs/aclnnAcosh.md:184 — 同类问题 - experimental/math/mod/docs/aclnnFmodScalar&aclnnInplaceFmodScalar.md:32 — 同类问题 - experimental/math/mod/docs/aclnnFmodTensor&aclnnInplaceFmodTensor.md:32 — 同类问题 ## 验证 - 修改前:ls experimental/math/arange/docs/examples/ → 目录不存在 - 修改后:ls ../examples/test_aclnn_*.cpp(从各 docs/ 目录)→ 4 个文件均存在,路径可达 - 对照:experimental/math/bias_add/docs/aclnnBiasAdd.md 已使用正确的 ../examples/ 写法,本 MR 与其保持一致 - pre-commit hooks(trailing whitespace / codespell / OAT)全部通过 ## 测试计划 - [x] 纯文档路径修复,无代码逻辑变更 - [x] 4 处 ../examples/ 路径均已验证指向真实文件 - [x] pre-commit 钩子通过 See merge request: cann/ops-math!4400 | 2 个月前 | |
新增mod算子Ascend C实现 Co-authored-by: tieyutong<tieyutong@huawei.com> # message auto-generated for no-merge-commit merge: !3240 merge upload-mod-20260610 into master 新增mod算子Ascend C实现 Created-by: tieyutong Commit-by: tieyutong Merged-by: cann-robot Description: ## 描述 本 PR 新增 mod算子Ascend C实现,上传路径为experimental/math/mod。提供 aclnnFmodTensor、aclnnInplaceFmodTensor、aclnnFmodScalar、aclnnInplaceFmodScalar 四个接口,支持 Tensor-Tensor、Tensor-Scalar 以及 inplace 场景。 主要改动: - 新增 Mod 算子 op_host、op_kernel、op_api 实现。 - host 侧完成 dtype、shape、broadcast 校验、infershape、tiling 与 workspace 配置。 - kernel 侧支持 FLOAT32、FLOAT16、BF16、INT32 AICore 计算路径,并支持 scalar、same-shape、broadcast 输入。 - op_api 侧支持 DOUBLE、BF16、FLOAT16、FLOAT32、INT32、INT64、INT8、UINT8,非 kernel 原生 dtype 通过 cast 到可计算 dtype 后执行。 - 补充 README、aclnn 接口文档、examples 以及 UT 用例。 ## 关联的Issue https://gitcode.com/cann/ops-math/issues/1928 ## 测试 已完成以下验证: | 套件 | 用例数 | 结果 | | --- | ---: | --- | | aclnnFmodScalar Accu_Generalization | 5600 | Pass,按区间分段续跑完成 | | aclnnFmodTensor Perf_Generalization | 16 | Pass,device 性能达标 | | aclnnFmodScalar Perf_Generalization | 16 | Pass,device 性能达标 | CI/工程验证: | 项目 | 结果 | | --- | --- | | experimental package 编译 | Pass | | CI UT pipeline | Pass | | op_host UT | Pass,7 tests | | op_api UT | Pass,9 tests | | op_kernel UT | Pass,1 test | | package 出包 | Pass | ## 文档更新 - 新增 experimental/math/mod/README.md - 新增 aclnnFmodTensor & aclnnInplaceFmodTensor 接口文档 - 新增 aclnnFmodScalar & aclnnInplaceFmodScalar 接口文档 - 新增 examples 与 tests 目录 ## 类型标签 - [ ] Bug修复 - [x] 新特性 - [x] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!3240 | 4 个月前 | |
新增mod算子Ascend C实现 Co-authored-by: tieyutong<tieyutong@huawei.com> # message auto-generated for no-merge-commit merge: !3240 merge upload-mod-20260610 into master 新增mod算子Ascend C实现 Created-by: tieyutong Commit-by: tieyutong Merged-by: cann-robot Description: ## 描述 本 PR 新增 mod算子Ascend C实现,上传路径为experimental/math/mod。提供 aclnnFmodTensor、aclnnInplaceFmodTensor、aclnnFmodScalar、aclnnInplaceFmodScalar 四个接口,支持 Tensor-Tensor、Tensor-Scalar 以及 inplace 场景。 主要改动: - 新增 Mod 算子 op_host、op_kernel、op_api 实现。 - host 侧完成 dtype、shape、broadcast 校验、infershape、tiling 与 workspace 配置。 - kernel 侧支持 FLOAT32、FLOAT16、BF16、INT32 AICore 计算路径,并支持 scalar、same-shape、broadcast 输入。 - op_api 侧支持 DOUBLE、BF16、FLOAT16、FLOAT32、INT32、INT64、INT8、UINT8,非 kernel 原生 dtype 通过 cast 到可计算 dtype 后执行。 - 补充 README、aclnn 接口文档、examples 以及 UT 用例。 ## 关联的Issue https://gitcode.com/cann/ops-math/issues/1928 ## 测试 已完成以下验证: | 套件 | 用例数 | 结果 | | --- | ---: | --- | | aclnnFmodScalar Accu_Generalization | 5600 | Pass,按区间分段续跑完成 | | aclnnFmodTensor Perf_Generalization | 16 | Pass,device 性能达标 | | aclnnFmodScalar Perf_Generalization | 16 | Pass,device 性能达标 | CI/工程验证: | 项目 | 结果 | | --- | --- | | experimental package 编译 | Pass | | CI UT pipeline | Pass | | op_host UT | Pass,7 tests | | op_api UT | Pass,9 tests | | op_kernel UT | Pass,1 test | | package 出包 | Pass | ## 文档更新 - 新增 experimental/math/mod/README.md - 新增 aclnnFmodTensor & aclnnInplaceFmodTensor 接口文档 - 新增 aclnnFmodScalar & aclnnInplaceFmodScalar 接口文档 - 新增 examples 与 tests 目录 ## 类型标签 - [ ] Bug修复 - [x] 新特性 - [x] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!3240 | 4 个月前 | |
build: 将 op_graph 目录下所有 cpp 编入 libopsgraph_math.so Co-authored-by: songkai111<songkai16@huawei.com> # message auto-generated for no-merge-commit merge: !4484 merge master into master build: 将 op_graph 目录下所有 cpp 编入 libopsgraph_math.so Created-by: songkai111 Commit-by: songkai111 Merged-by: cann-robot Description: ## 描述 将 op_graph 目录下所有 cpp 文件递归编入 libopsgraph_math.so。原 cmake 配置仅编译匹配 *_graph_*.cpp、*_fallback.cpp、fusion_pass/*_pass.cpp 的文件,新增 op_graph 文件需手动调整 glob 模式;改为 GLOB_RECURSE 递归收集 op_graph 目录下所有 .cpp,后续新增文件自动纳入编译。 具体改动(cmake/func.cmake 两处): - add_all_modules_sources:file(GLOB ...) 改为 file(GLOB_RECURSE OP_GRAPH_SRCS ${SOURCE_DIR}/op_graph/*.cpp) - add_graph_plugin_sources:file(GLOB ...) 改为 file(GLOB_RECURSE OP_GRAPH_SRCS ${SOURCE_DIR}/*.cpp) ## 关联的Issue - #2540: 将 op_graph 目录下所有 cpp 自动编入 libopsgraph_math.so ## 测试 - 本地编译 ops-math,验证 libopsgraph_math.so 正常生成,op_graph 目录下新增 cpp 文件的符号被纳入。 ## 文档更新 无 ## 类型标签 - [ ] Bug修复 - [ ] 新特性 - [ ] 性能优化 - [ ] 文档更新 - [x] 其他,请描述:构建系统优化 See merge request: cann/ops-math!4484 | 2 个月前 | |
新增mod算子Ascend C实现 Co-authored-by: tieyutong<tieyutong@huawei.com> # message auto-generated for no-merge-commit merge: !3240 merge upload-mod-20260610 into master 新增mod算子Ascend C实现 Created-by: tieyutong Commit-by: tieyutong Merged-by: cann-robot Description: ## 描述 本 PR 新增 mod算子Ascend C实现,上传路径为experimental/math/mod。提供 aclnnFmodTensor、aclnnInplaceFmodTensor、aclnnFmodScalar、aclnnInplaceFmodScalar 四个接口,支持 Tensor-Tensor、Tensor-Scalar 以及 inplace 场景。 主要改动: - 新增 Mod 算子 op_host、op_kernel、op_api 实现。 - host 侧完成 dtype、shape、broadcast 校验、infershape、tiling 与 workspace 配置。 - kernel 侧支持 FLOAT32、FLOAT16、BF16、INT32 AICore 计算路径,并支持 scalar、same-shape、broadcast 输入。 - op_api 侧支持 DOUBLE、BF16、FLOAT16、FLOAT32、INT32、INT64、INT8、UINT8,非 kernel 原生 dtype 通过 cast 到可计算 dtype 后执行。 - 补充 README、aclnn 接口文档、examples 以及 UT 用例。 ## 关联的Issue https://gitcode.com/cann/ops-math/issues/1928 ## 测试 已完成以下验证: | 套件 | 用例数 | 结果 | | --- | ---: | --- | | aclnnFmodScalar Accu_Generalization | 5600 | Pass,按区间分段续跑完成 | | aclnnFmodTensor Perf_Generalization | 16 | Pass,device 性能达标 | | aclnnFmodScalar Perf_Generalization | 16 | Pass,device 性能达标 | CI/工程验证: | 项目 | 结果 | | --- | --- | | experimental package 编译 | Pass | | CI UT pipeline | Pass | | op_host UT | Pass,7 tests | | op_api UT | Pass,9 tests | | op_kernel UT | Pass,1 test | | package 出包 | Pass | ## 文档更新 - 新增 experimental/math/mod/README.md - 新增 aclnnFmodTensor & aclnnInplaceFmodTensor 接口文档 - 新增 aclnnFmodScalar & aclnnInplaceFmodScalar 接口文档 - 新增 examples 与 tests 目录 ## 类型标签 - [ ] Bug修复 - [x] 新特性 - [x] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!3240 | 4 个月前 | |
新增mod算子Ascend C实现 Co-authored-by: tieyutong<tieyutong@huawei.com> # message auto-generated for no-merge-commit merge: !3240 merge upload-mod-20260610 into master 新增mod算子Ascend C实现 Created-by: tieyutong Commit-by: tieyutong Merged-by: cann-robot Description: ## 描述 本 PR 新增 mod算子Ascend C实现,上传路径为experimental/math/mod。提供 aclnnFmodTensor、aclnnInplaceFmodTensor、aclnnFmodScalar、aclnnInplaceFmodScalar 四个接口,支持 Tensor-Tensor、Tensor-Scalar 以及 inplace 场景。 主要改动: - 新增 Mod 算子 op_host、op_kernel、op_api 实现。 - host 侧完成 dtype、shape、broadcast 校验、infershape、tiling 与 workspace 配置。 - kernel 侧支持 FLOAT32、FLOAT16、BF16、INT32 AICore 计算路径,并支持 scalar、same-shape、broadcast 输入。 - op_api 侧支持 DOUBLE、BF16、FLOAT16、FLOAT32、INT32、INT64、INT8、UINT8,非 kernel 原生 dtype 通过 cast 到可计算 dtype 后执行。 - 补充 README、aclnn 接口文档、examples 以及 UT 用例。 ## 关联的Issue https://gitcode.com/cann/ops-math/issues/1928 ## 测试 已完成以下验证: | 套件 | 用例数 | 结果 | | --- | ---: | --- | | aclnnFmodScalar Accu_Generalization | 5600 | Pass,按区间分段续跑完成 | | aclnnFmodTensor Perf_Generalization | 16 | Pass,device 性能达标 | | aclnnFmodScalar Perf_Generalization | 16 | Pass,device 性能达标 | CI/工程验证: | 项目 | 结果 | | --- | --- | | experimental package 编译 | Pass | | CI UT pipeline | Pass | | op_host UT | Pass,7 tests | | op_api UT | Pass,9 tests | | op_kernel UT | Pass,1 test | | package 出包 | Pass | ## 文档更新 - 新增 experimental/math/mod/README.md - 新增 aclnnFmodTensor & aclnnInplaceFmodTensor 接口文档 - 新增 aclnnFmodScalar & aclnnInplaceFmodScalar 接口文档 - 新增 examples 与 tests 目录 ## 类型标签 - [ ] Bug修复 - [x] 新特性 - [x] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!3240 | 4 个月前 | |
新增mod算子Ascend C实现 Co-authored-by: tieyutong<tieyutong@huawei.com> # message auto-generated for no-merge-commit merge: !3240 merge upload-mod-20260610 into master 新增mod算子Ascend C实现 Created-by: tieyutong Commit-by: tieyutong Merged-by: cann-robot Description: ## 描述 本 PR 新增 mod算子Ascend C实现,上传路径为experimental/math/mod。提供 aclnnFmodTensor、aclnnInplaceFmodTensor、aclnnFmodScalar、aclnnInplaceFmodScalar 四个接口,支持 Tensor-Tensor、Tensor-Scalar 以及 inplace 场景。 主要改动: - 新增 Mod 算子 op_host、op_kernel、op_api 实现。 - host 侧完成 dtype、shape、broadcast 校验、infershape、tiling 与 workspace 配置。 - kernel 侧支持 FLOAT32、FLOAT16、BF16、INT32 AICore 计算路径,并支持 scalar、same-shape、broadcast 输入。 - op_api 侧支持 DOUBLE、BF16、FLOAT16、FLOAT32、INT32、INT64、INT8、UINT8,非 kernel 原生 dtype 通过 cast 到可计算 dtype 后执行。 - 补充 README、aclnn 接口文档、examples 以及 UT 用例。 ## 关联的Issue https://gitcode.com/cann/ops-math/issues/1928 ## 测试 已完成以下验证: | 套件 | 用例数 | 结果 | | --- | ---: | --- | | aclnnFmodScalar Accu_Generalization | 5600 | Pass,按区间分段续跑完成 | | aclnnFmodTensor Perf_Generalization | 16 | Pass,device 性能达标 | | aclnnFmodScalar Perf_Generalization | 16 | Pass,device 性能达标 | CI/工程验证: | 项目 | 结果 | | --- | --- | | experimental package 编译 | Pass | | CI UT pipeline | Pass | | op_host UT | Pass,7 tests | | op_api UT | Pass,9 tests | | op_kernel UT | Pass,1 test | | package 出包 | Pass | ## 文档更新 - 新增 experimental/math/mod/README.md - 新增 aclnnFmodTensor & aclnnInplaceFmodTensor 接口文档 - 新增 aclnnFmodScalar & aclnnInplaceFmodScalar 接口文档 - 新增 examples 与 tests 目录 ## 类型标签 - [ ] Bug修复 - [x] 新特性 - [x] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!3240 | 4 个月前 | |
新增mod算子Ascend C实现 Co-authored-by: tieyutong<tieyutong@huawei.com> # message auto-generated for no-merge-commit merge: !3240 merge upload-mod-20260610 into master 新增mod算子Ascend C实现 Created-by: tieyutong Commit-by: tieyutong Merged-by: cann-robot Description: ## 描述 本 PR 新增 mod算子Ascend C实现,上传路径为experimental/math/mod。提供 aclnnFmodTensor、aclnnInplaceFmodTensor、aclnnFmodScalar、aclnnInplaceFmodScalar 四个接口,支持 Tensor-Tensor、Tensor-Scalar 以及 inplace 场景。 主要改动: - 新增 Mod 算子 op_host、op_kernel、op_api 实现。 - host 侧完成 dtype、shape、broadcast 校验、infershape、tiling 与 workspace 配置。 - kernel 侧支持 FLOAT32、FLOAT16、BF16、INT32 AICore 计算路径,并支持 scalar、same-shape、broadcast 输入。 - op_api 侧支持 DOUBLE、BF16、FLOAT16、FLOAT32、INT32、INT64、INT8、UINT8,非 kernel 原生 dtype 通过 cast 到可计算 dtype 后执行。 - 补充 README、aclnn 接口文档、examples 以及 UT 用例。 ## 关联的Issue https://gitcode.com/cann/ops-math/issues/1928 ## 测试 已完成以下验证: | 套件 | 用例数 | 结果 | | --- | ---: | --- | | aclnnFmodScalar Accu_Generalization | 5600 | Pass,按区间分段续跑完成 | | aclnnFmodTensor Perf_Generalization | 16 | Pass,device 性能达标 | | aclnnFmodScalar Perf_Generalization | 16 | Pass,device 性能达标 | CI/工程验证: | 项目 | 结果 | | --- | --- | | experimental package 编译 | Pass | | CI UT pipeline | Pass | | op_host UT | Pass,7 tests | | op_api UT | Pass,9 tests | | op_kernel UT | Pass,1 test | | package 出包 | Pass | ## 文档更新 - 新增 experimental/math/mod/README.md - 新增 aclnnFmodTensor & aclnnInplaceFmodTensor 接口文档 - 新增 aclnnFmodScalar & aclnnInplaceFmodScalar 接口文档 - 新增 examples 与 tests 目录 ## 类型标签 - [ ] Bug修复 - [x] 新特性 - [x] 性能优化 - [x] 文档更新 - [ ] 其他,请描述: See merge request: cann/ops-math!3240 | 4 个月前 |
Mod
产品支持情况
| 产品 | 是否支持 |
|---|---|
| Ascend 950PR/Ascend 950DT | √ |
| Atlas A3 训练系列产品/Atlas A3 推理系列产品 | √ |
| Atlas A2 训练系列产品/Atlas A2 推理系列产品 | √ |
| Atlas 200I/500 A2 推理产品 | × |
| Atlas 推理系列产品 | √ |
| Atlas 训练系列产品 | √ |
功能说明
-
算子功能:返回 self 除以 other 的余数。
-
计算公式:
对于入参 self 和比较标量 other,Fmod 可以用如下数学公式表示:
outi=selfi−(other×trunc(selfi/other))out_{i} = self_{i} - (other \times trunc(self_{i}/other)) outi=selfi−(other×trunc(selfi/other))
参数说明
| 参数名 | 输入/输出/属性 | 描述 | 数据类型 | 数据格式 |
|---|---|---|---|---|
| self | 输入 | 待进行mod计算的入参,公式中的self_i。 | BFLOAT16、FLOAT16、FLOAT32、INT32 | ND |
| other | 输入 | 待进行mod计算的入参,公式中的other。 | BFLOAT16、FLOAT16、FLOAT32、INT32 | ND |
| out | 输出 | 待进行mod计算的出参,公式中的out_i。 | BFLOAT16、FLOAT16、FLOAT32、INT32 | ND |
约束说明
- aclnn 层支持 DOUBLE、BFLOAT16、FLOAT16、FLOAT32、INT32、INT64、INT8、UINT8 类型推导;AICore kernel 覆盖 BFLOAT16、FLOAT16、FLOAT32、INT32,其余类型走 AICPU fallback。
- self和out的shape必须一致。
- 数据维度不支持8维以上。
调用说明
| 调用方式 | 样例代码 | 说明 |
|---|---|---|
| aclnn接口 | test_aclnn_fmod_scalar | 通过aclnnFmodScalar接口方式调用Mod算子。 |
| aclnn接口 | test_aclnn_fmod_tensor | 通过aclnnFmodTensor接口方式调用Mod算子。 |