已合并
isClose的示例中的输出类型不匹配 #4497
季骏创建于 18 天前
isClose的示例中的输出类型不匹配 #4497
已合并
季骏创建于 18 天前
季骏
季骏成员
18 天前

描述

isClose的aclnn demo中,存在变量申请的类型和使用的类型不匹配的问题

关联的Issue

#2543

测试

已测试通过

文档更新

math/is_close/docs/aclnnIsClose.md

类型标签

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 季骏 的贡献)
季骏季骏成员
18 天前 创建了 pull request,commit 19bc32d6
atomgit-bot
atomgit-bot
18 天前 评论:

变更摘要

此 PR 修复了 aclnnIsClose 示例代码中输出变量类型与 API 实际输出类型不匹配的问题。isClose 的输出应为布尔型(uint8_t),但示例中错误地使用了 float 类型来接收结果和打印,导致类型不一致。同时更新了对应的文档说明。

主要改动

  • test_aclnn_isclose.cpp 输出缓冲区类型修正: 将 resultData 的类型从 std::vector<float> 改为 std::vector<uint8_t>,使输出缓冲区类型与 isClose API 返回的布尔结果类型一致。
  • aclrtMemcpy 拷贝大小计算修正: 将硬编码的 size * sizeof(float) 改为 size * sizeof(resultData[0]),确保拷贝字节数自动跟随 resultData 的元素类型变化,消除手动维护类型一致性带来的风险。
  • 结果打印格式修正: 将 LOG_PRINT 中的格式化占位符从 %f(浮点)改为 %d(整数),匹配 uint8_t 类型的实际输出。
likedislike
atomgit-bot
atomgit-bot
18 天前 评论:

代码审查

✅ 未发现问题

likedislike
CANN-robotCANN-robot成员
18 天前 添加了label:cann-cla/yes
CANN-robot
CANN-robot成员
18 天前 评论:

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
*/*/docs/acl*.md 汤平川, 陈娇 (2/2) 陈娇 (1/1)
math/is_close 汤平川, 宋恺 (2/2) 汤平川, 宋恺 (2/1)

💡 Tip:

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

CLA Signature Pass

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

likedislike
此处折叠了48条消息 查看更多
TangPC
TangPC成员
15 天前 评论:

/lgtm
/approve

likedislike
CANN-robot
CANN-robot成员
15 天前 评论:

The following users do not have permission to comment /lgtm or /approve on any module in this PR:
苏跃明

likedislike
CANN-robotCANN-robot成员
15 天前 添加了label:lgtm
CANN-robotCANN-robot成员
15 天前 关闭了关联的issue
CANN-robotCANN-robot成员
15 天前 合入了pull request