Closed
PyPTO basic operations CLI documentation mismatch #3452
KaranocaVeAdd on Sep 24Closed at Oct 10
Sep 24 Modify description of issue
Sep 24 Modify description of issue
lidongsheng
Sep 28 Comments:
Sep 28 Comments:
请及时处理相关PR


KaranocaVe
Sep 28 Comments:
Sep 28 Comments:
已重新检查 PR !6719 当前 head deffa51。改动仍只有两份 README;两次流水线分析都指向未修改的 python/tests/ut/pypto_pro/test_error_format.py:934,目前没有证据表明失败由这次文档变更引起,因此没有改代码或重复触发流水线。PR Approval Progress 仍显示 examples 模块为 0/2 LGTM、0/1 approve;检查也显示我当前没有 PUSH 权限。请模块维护者确认该 UT 失败的处理方式并补齐审批,由有权限的成员完成合入。


Oct 8 Assign songle1 as responsible person
Oct 8 Added label: Frontend
lidongsheng
Oct 8 Comments:
Oct 8 Comments:
感谢对PyPTO项目贡献,PR reviewed


KaranocaVe
Oct 10 Comments:
Oct 10 Comments:
已由关联 PR !6719 修复并合入,关闭此 Issue。


Oct 10 Close issue
Oct 11 Added label: resolved
KaranocaVe
Oct 22 Comments:
Oct 22 Comments:
@tsungl4 您好,这个 Issue 对应的修复已经合入:https://gitcode.com/cann/pypto/merge_requests/6719
开发者计划反馈,Issue 需要有 Accepted 标签才能计入积分,仅关闭或标记 resolved 还不够。目前这条 Issue 尚未标记 Accepted,麻烦您结合问题和已合入的修复复核一下;确认符合受理条件后,帮忙补上 Accepted 标签。
感谢您的支持!


PyPTO basic operations CLI documentation mismatch
Scope
cann/pypto289942aa3e0c0c0bc9e054c72bafb199200e392fPublic evidence
The two top-level examples guides describe these commands:
At the fixed source commit,
basic_ops.pyregistersmatmulas a test name (lines 171-177), and its parser defines only-m/--run_modeand-t/--tests(lines 179-195). There is no positional test selector and no--listoption. The specific test command must therefore be--tests matmul;--helpis the available way to display the choices.Expected and actual behavior
matmul::test_matmulis rejected as an unrecognized positional argument, and--listis rejected as an unrecognized option. The guide cannot be followed as written for either documented workflow.Controls and boundary
The argparse behavior was checked with a minimal import stub so the parser could be exercised without changing the source or requiring PyTorch/PyPTO.
--helpexits 0 and lists-m/--run_mode,-t/--tests, and choices includingmatmul; both documented invalid forms exit 2. A valid parser control,--tests matmul --run_mode sim, is accepted and proceeds to the selected test.The host used for validation does not provide
torch,pypto, ortorch_npu, so full kernel execution was not claimed. This limitation does not affect the argparse contract or the documentation defect.Minimal repair
Update the two commands in both language versions of
examples/README:--tests matmul;--listcommand with--help, whose output includes all available test choices.No source-code behavior change is required.
Validation
Validation
Fixed source
The source checkout resolved the requested commit exactly. Public commit-pinned URLs for both README files and
basic_ops.pyreturned HTTP 200.Static contract
At
examples/01_beginner/basic/basic_ops.py:add,erfc,matmul,sum, anddynamic_add;-m/--run_modeand-t/--tests;At
examples/README.mdandexamples/README_en.md, lines 53 and 56 respectively use the unsupported positional selector and--listoption.Commands and results
The direct command was attempted first:
python3 examples/01_beginner/basic/basic_ops.py --helpExit code:
1Key output:
The environment has no
torch,pypto, ortorch_npu. To isolate the documented CLI contract from those runtime prerequisites, the same script was loaded with minimaltorchandpyptoimport stubs. The stubs did not replaceargparseor alter the parser.The last command reaches
test_matmul, proving that the corrected selector and run-mode options are accepted by argparse; the subsequent failure is only the intentionally minimal runtime stub.Patch validation
The proposed
fix.patchchanges only the four stale command lines in the Chinese and English top-level examples guides. The patch was regenerated without blank context lines, so the patch file itself has no trailing-whitespace diagnostics at the four previously reported lines.Validation was performed against source commit
289942aa3e0c0c0bc9e054c72bafb199200e392f:git apply --check --unidiff-zero fix.patch # exit 0 # In a temporary Git copy initialized from the two fixed-commit README files: git apply --unidiff-zero fix.patch # exit 0 git diff --check -- examples/README.md examples/README_en.md # exit 0The patch is generated with
git diff -U0, so applying it requires Git's explicit--unidiff-zerooption. The applied diff contains six insertions and six deletions, limited to the two documented command pairs and their comments. No source file or runtime behavior is changed.Conclusion
The defect is reproducible at the pinned commit as a documentation-to-CLI mismatch. The smallest repair is a documentation-only update in both language files. Full NPU/kernel execution remains outside this validation because the required runtime packages and device environment are absent.
关联 PR: https://gitcode.com/cann/pypto/merge_requests/6719