Merged
fix(examples): Separate dynamic logic from elementwise_ops and complete dynamic usage examples #1220
shengxinchenAdd on Feb 27
fix(examples): Separate dynamic logic from elementwise_ops and complete dynamic usage examples #1220
Merged
shengxinchenAdd on Feb 27
shengxinchen
shengxinchenCollaborators
Feb 27

描述

本次 PR 对 examples 目录下的示例代码进行了职责拆分与内容补全,主要包括:

  • elementwise_ops.py 职责聚焦:移除其中 dynamic 相关的条件分支逻辑,使该示例仅表达 elementwise
    相关的计算操作,职责更加清晰;
  • dynamic.py 示例补全:补全 pypto 动态特性的撰写规范示例,涵盖在模块级别定义动态维度,以及配合 view/assemble
    等进行显式循环与分块处理等用法,使动态场景的示例更加完整、易于理解。

说明:上述修改旨在让各示例文件职责单一、表达清晰,降低用户理解成本。

测试

  • 验证修改后的 elementwise_ops.py 可正常运行,且不再包含 dynamic 相关逻辑;
  • 验证补全后的 dynamic.py 各示例可正常运行,用法覆盖更全面。

类型标签

Related Issue: #463

likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for shengxinchen's contribution.)
shengxinchenshengxinchenCollaborators
Feb 27 Created pull request, commit 43b0dd27
shengxinchenshengxinchenCollaborators
Feb 27 Associated issue: [Bug-Report|缺陷反馈]: 【green light】elementwise_ops.py的add::test_add_basic样例跑动态模式报错
CANN-robot
CANN-robotCollaborators
Feb 27 Comments:

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


PR Approval Progress

✅ Congratulations! All modules have met the lgtm and approve requirements.

Module Approval Details

module lgtm status approve status
repo-cann/pypto ✅ wcwxy, lyfne (2/2) ✅ lyfne (1/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)
likedislike
CANN-robotCANN-robotCollaborators
Feb 27 Set cam_bxh,dai-zhentao,zhangqi-chen,jiawei_zhuang,gguuaanngg,DCGDDD,syfeng,jason_yuan_ye,foundea,hw_zhangzhiqi,yinjie27_,lyfne,zhangyuebing,tsungl4,gaoxingwang,zhoubotcam,wcwxy,linjiashu,poursoul,gcw_9WvwSY5N as approver
CANN-robotCANN-robotCollaborators
Feb 27 Set cam_bxh,dai-zhentao,zhangqi-chen,jiawei_zhuang,gguuaanngg,DCGDDD,syfeng,jason_yuan_ye,foundea,hw_zhangzhiqi,yinjie27_,lyfne,zhangyuebing,tsungl4,gaoxingwang,zhoubotcam,wcwxy,linjiashu,poursoul,gcw_9WvwSY5N as approver
CANN-robotCANN-robotCollaborators
Feb 27 Added label: cann-cla/yes
CANN-robot
CANN-robotCollaborators
Feb 27 Comments:

CLA Signature Pass

shengxinchen, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
CANN-robot
CANN-robotCollaborators
Feb 27 Comments:

🔵 source code change are detected, tasks labels is removed in this pull request!

likedislike
shengxinchen
shengxinchenCollaborators
Feb 27 Comments:

compile

likedislike
CANN-robotCANN-robotCollaborators
Feb 27 Added label: ci-pipeline-running
CANN-robot
CANN-robotCollaborators
Feb 27 Comments:

流水线任务触发成功 [流水线指导]
任务链接 [babfcc5505184553adced76b7b07a045]

任务名称状态日志下载链接
codecheck ❌ FAILED >>>>>
SCA ✅ SUCCESS >>>>>
anti_virus ✅ SUCCESS
Check_Pr ✅ SUCCESS >>>>>
Compile_Ascend_X86 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM ✅ SUCCESS >>>>> >>>>>
pre_comment ✅ SUCCESS >>>>>
UT_Test_Py3_ninja_simulation ⚪ ABORTED
UT_Test_Py3_ninja ⚪ ABORTED
UT_Test_Cpp_make_clang ⚪ ABORTED
UT_Test_Cpp_make_gnu ⚪ ABORTED
UT_Test_Cpp_make_gnu_part_1 ⚪ ABORTED
UT_Test_Cpp_make_gnu_part_2 ⚪ ABORTED
UT_Test_Cpp_make_gnu_part_3 ⚪ ABORTED
UT_Test_report ⚪ ABORTED >>>>>
Smoke_A900 ⚪ ABORTED >>>>>

[2026-02-27 18:04:02]    CI执行失败

likedislike
CANN-robotCANN-robotCollaborators
Feb 27 Removed label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
Feb 27 Added label: ci-pipeline-failed
shengxinchen
shengxinchenCollaborators
Feb 27 Comments:

compile

likedislike
CANN-robotCANN-robotCollaborators
Feb 27 Removed label: ci-pipeline-failed
CANN-robotCANN-robotCollaborators
Feb 27 Added label: ci-pipeline-running
CANN-robot
CANN-robotCollaborators
Feb 27 Comments:

流水线任务触发成功 [流水线指导]
任务链接 [427fca97b53d4347b636108d96ecf343]

任务名称状态日志下载链接
codecheck ✅ SUCCESS >>>>>
SCA ✅ SUCCESS >>>>>
anti_virus ✅ SUCCESS >>>>>
Check_Pr ✅ SUCCESS >>>>>
Compile_Ascend_X86 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM ✅ SUCCESS >>>>> >>>>>
pre_comment ✅ SUCCESS >>>>>
UT_Test_Py3_ninja_simulation ✅ SUCCESS
UT_Test_Py3_ninja ✅ SUCCESS
UT_Test_Cpp_make_clang ✅ SUCCESS
UT_Test_Cpp_make_gnu ✅ SUCCESS
UT_Test_Cpp_make_gnu_part_1 ✅ SUCCESS
UT_Test_Cpp_make_gnu_part_2 ✅ SUCCESS
UT_Test_Cpp_make_gnu_part_3 ✅ SUCCESS
UT_Test_report ✅ SUCCESS >>>>>
Smoke_A900 ✅ SUCCESS >>>>> >>>>>

[2026-02-27 19:08:26]    CI执行结束

likedislike
CANN-robotCANN-robotCollaborators
Feb 27 Removed label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
Feb 27 Added label: ci-pipeline-passed
wcwxy
wcwxyCollaborators
Feb 28 Comments:

/lgtm

likedislike
linyifan
linyifanCollaborators
Feb 28 Comments:

/approve

likedislike
CANN-robotCANN-robotCollaborators
Feb 28 Added label: lgtmapproved
CANN-robot
CANN-robotCollaborators
Feb 28 Comments:

Review Guide

This pull-request passes review.
Committers who wrote a comment of /approve are: lyfne.
Reviewers who wrote a comment of /lgtm are: lyfne, wcwxy.

likedislike
CANN-robotCANN-robotCollaborators
Feb 28 Merged pull request