Merged
examples result print #292
examples result print #292
Merged
张田荣Add on Aug 27
张田荣
张田荣Collaborators
Aug 27

描述

1、examples输出结果表格增加精度结果显示
2、QUICKSTART.md相关章节增加未联网编译内容

关联的Issue

https://gitcode.com/cann/ops-tensor/issues/189

测试

文档更新

QUICKSTART.md

类型标签

likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for 张田荣's contribution.)
张田荣张田荣Collaborators
Aug 27 Created pull request, commit 17306647
张田荣张田荣Collaborators
Aug 27 Associated issue: [Requirement|需求建议]: 打印算子的npu输出和标杆输出的精度对比结果,并在result文件中显示
atomgit-bot
atomgit-bot
Aug 27 Comments:

变更摘要

本 PR 主要聚焦 examples 运行结果的精度显示与收集:新增公共指标模块 examples/common/metrics.py,为各示例的 verify_result.py 提供统一的 verify_metrics.json 写入能力;扩展 examples/common/run_case.py,在用例结果输出中增加 accuracy(精度)、tol accuracy 与 max_abs_diff 等指标显示,并在结果 CSV 中新增 accuracy、metrics_json 两列。同时按 PR 描述更新 QUICKSTART.md 文档(补充未联网/离线编译内容),并更新 include/tensor_api 子模块指针。

主要改动

  • 新增公共指标模块 examples/common/metrics.py:提供 write_metrics_json(将各输出项的 max_abs_diff、error_ratio、ratio_tol、elements、status 写入 ./output/verify_metrics.json)以及 parse_stdout_metrics(缺少 JSON 文件时回退解析 verify stdout,支持 [verify] name:、[INFO] group N: 等块结构)。

  • 各示例 verify 脚本接入指标写入:batch_mat_mul、mat_mul、grouped_matmul、quant_batch_matmul(verify_result_cube.py/verify_result_mx.py)、quant_matmul_activation_quant、transpose_batch_mat_mul、weight_quant_batch_matmul_mx 等 verify_result.py 均调用 write_metrics_json 记录精度指标与总体状态(pass/fail);其中 grouped_matmul 按 group 逐个收集指标,quant_matmul_activation_quant 通过 _COLLECTED_METRICS 汇总多个输出项。

  • examples/common/run_case.py 结果展示与输出增强:用例执行后通过 _load_metrics 读取 verify_metrics.json(缺失或解析失败时回退 parse_stdout_metrics),将 error_ratio 换算为 accuracy 百分比,在 PASS/FAIL 输出中打印 accuracy、tol accuracy 与 max_abs_diff,并新增 _extract_accuracy、_format_metrics_json 辅助函数,在结果 CSV 中增加 accuracy、metrics_json 两列。

  • 文档与子模块更新:按 PR 描述在 QUICKSTART.md 相关章节补充未联网(离线)编译内容;同时 include/tensor_api 子模块指针由 d63c30cb... 更新至 ad3d3bf0...。

likedislike
Incorrect?
atomgit-bot
atomgit-bot
Aug 27 Comments:

代码审查

✅ 未发现问题

likedislike
Incorrect?
CANN-robotCANN-robotCollaborators
Aug 27 Added label: cann-cla/yes
CANN-robot
CANN-robotCollaborators
Aug 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.
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/ops-tensor ✅ 商晓波, 陈康 (2/2) ✅ 商晓波 (1/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)

CLA Signature Pass

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

likedislike
张田荣张田荣Collaborators
Aug 27 Pre merge succeeded (commit_id: 63e61c12362e13b88b90e66a99791786336b0a31)
8 event messages are collapsed here。 See more
CANN-robotCANN-robotCollaborators
Aug 27 Added label: cann-cla/yes
张田荣
张田荣Collaborators
Aug 27 Comments:

compile

likedislike
张田荣张田荣Collaborators
Aug 27 Pre merge succeeded (commit_id: f54c6ce299a14994808490e1eb542c55b5a7b15d)
CANN-robotCANN-robotCollaborators
Aug 27 Added label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
Aug 27 Removed label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
Aug 27 Added label: ci-pipeline-passed
sxb154714
sxb154714Collaborators
Aug 28 Comments:

/lgtm
/approve

likedislike
CANN-robotCANN-robotCollaborators
Aug 28 Added label: approved
chen-kang30
chen-kang30Collaborators
Aug 28 Comments:

/lgtm

likedislike
CANN-robotCANN-robotCollaborators
Aug 28 Added label: lgtm
CANN-robotCANN-robotCollaborators
Aug 28 Closed associated issue
CANN-robotCANN-robotCollaborators
Aug 28 Merged pull request