Pull Request已成功合入, 合并人@CANN-robot
(感谢 tianjun 的贡献)变更摘要
本 PR 在 2026/CANN-Code-Detective/Challenge07-SigmoidCustom/PR_code/Ethan_Zou_07/ 下提交了一套完整的 Sigmoid 自定义算子工程,覆盖算子定义、形状推导、Tiling、Kernel 实现与测试用例。算子定义 Sigmoid 以 x 为输入、y 为输出,支持 DT_FLOAT 与 DT_FLOAT16、FORMAT_ND 格式,并注册到 ascend910b 的 AICore;Tiling 侧根据输入形状与数据类型计算 blockFactor、ubFactor 并设置 tiling key,Kernel 侧以模板类 NsSigmoid::Sigmoid 按 schMode 分派 half/float 实现。同时提供了 aclnn 调用示例、build.sh 构建脚本以及基于 gtest 的 op_host / op_kernel 单元测试与精度比对脚本。
主要改动
- 算子定义与注册:新增
op_host/sigmoid_def.cpp,通过OpDef定义Sigmoid的输入x、输出y,数据类型为{ge::DT_FLOAT, ge::DT_FLOAT16},格式为FORMAT_ND并启用AutoContiguous,AICore配置为ascend910b。 - 形状推导与 Tiling 计算:新增
op_host/sigmoid_infershape.cpp实现InferShapeSigmoid,将输出 shape 直接对齐输入 shape;op_host/sigmoid_tiling.cpp的SigmoidTilingFunc读取平台信息与输入形状,计算totalNum、blockFactor、ubFactor,并按数据类型设置 tiling key(float16 与 float32 分别对应不同模板模式)。 - Kernel 实现:新增
op_kernel/sigmoid.h中的模板类NsSigmoid::Sigmoid,以BUFFER_NUM=2双缓冲、CopyIn/Compute/CopyOut流程调用AscendC::Sigmoid;op_kernel/sigmoid.cpp按模板参数schMode分派half与float实例;并新增sigmoid_tiling_data.h(SigmoidTilingData结构)与sigmoid_tiling_key.h(ASCENDC_TPL_ARGS_DECL数据类型模板声明)。 - Tiling 与形状推导单元测试:新增
tests/ut/common/下的tiling_context_faker、infershape_context_faker、any_value及对应 executor,并在tests/ut/op_host/test_sigmoid_tiling.cpp中定义 float32/float16 两组用例,校验 tiling key、tiling data 与 workspace。 - Kernel 测试与构建、示例脚本:新增
tests/ut/op_kernel/test_sigmoid.cpp直接构造SigmoidTilingData运行 kernel 并输出 bin,配合sigmoid_data/gen_data.py生成数据、compare_data.py按阈值进行精度比对;tests/ut/run.sh、根目录build.sh与examples/run.sh提供构建、UT 与aclnnSigmoid示例的执行入口。


Hi @Ethan_Zou, welcome to submitting your first PR to cann-outreach!
PR Merge Steps
1. CLA Signing
If the current PR label includes cann-cla/yes, it means you have signed the CLA and can proceed to the next step. If the label includes cann-cla/no, please sign the CLA first. If you have any questions, please refer to the FAQ.
2. CI Check
Please comment /compile to trigger the CI pipeline check. If the CI run is successful, the PR will be tagged with ci-pipeline-passed and you can proceed to the next step. If the CI run fails, the PR will be tagged with ci-pipeline-failed, please check the CI logs to fix the issues in the PR. If you have any questions, please refer to the FAQ.
3. Code Review
After CI passes, please refer to the PR Approval Progress and proactively @ the committers in the table to review the code. After approval, committers will comment /lgtm and /approve. Once the lgtm and approved labels are successfully added, the PR will be merged automatically.


Thanks for your pull-request.
The full list of commands accepted by me can be found at here.
You can get sig-info at here.
You can self-configure the PR merge rules for this repository. For more details, please refer to Here.
For more, you also can visit HICANN.
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| repo-cann/cann-outreach | ✅ shaoyf, 傅涛 (2/2) | ✅ shaoyf, 傅涛 (2/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)


当前 PR 是否有 AI 参与
PR 功能描述
在
2026/CANN-Code-Detective/Challenge07-SigmoidCustom/PR_code/Ethan_Zou_07/提交完整算子工程,补全 Tiling、Kernel、算子注册与测试。关联活动
cann-learning-hub issue #744。
参与信息
改动类型
测试信息
CANNJudge 提交 426729 通过 2/2,float16、float32 测试误差均为 0.00%。本地没有 CANN SDK,未运行本地构建与单元测试。
检查清单