已合并
fix: 修复random类算子example的编译和运行问题 #3167
xuejinghui创建于 6月8日
fix: 修复random类算子example的编译和运行问题 #3167
已合并
xuejinghui创建于 6月8日
xuejinghui成员
6月8日

描述

fix: 修复random类算子example的编译和运行问题

关联的Issue

https://gitcode.com/cann/ops-math/issues/1909

测试

四个随机数算子example均跑通

文档更新

类型标签

  • Bug修复
  • 新特性
  • 性能优化
  • 文档更新
  • 其他,请描述:
likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 xuejinghui 的贡献)
Xxuejinghui成员
6月8日 创建了 pull request,commit 5364f65f
CANN-robotCANN-robot成员
6月8日 添加了label:cann-cla/yes
CANN-robot
CANN-robot成员
6月8日 评论:

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/ops-math 宋凯, wangrui_ (2/2) 宋凯, wangrui_ (2/1)

💡 Tip:

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

CLA Signature Pass

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

likedislike
Xxuejinghui成员
6月8日 update merge request[project id: 7649531, iid: 3167, commit_id: db81e6923634e4d356d94effb0bc14157a7e7995] virtual merging success
Xxuejinghui成员
6月8日 强制推送  1 个提交:ed64ff1f-fix: 修复random类算子example的编译和运行问题
Xxuejinghui成员
6月8日 update merge request[project id: 7649531, iid: 3167, commit_id: bf6b4f95afd6f7b5e325ca1ab3986c399d159547] virtual merging success
Xxuejinghui成员
6月8日 update merge request[project id: 7649531, iid: 3167, commit_id: 8c2bcc4f795c36d43c67b85ead8375cde15a6726] virtual merging success
Xxuejinghui成员
6月8日 强制推送  1 个提交:acb4e11b-fix: 修复random类算子example的编译和运行问题
Xxuejinghui成员
6月8日 update merge request[project id: 7649531, iid: 3167, commit_id: c17d17705a6a166acb53753748ac9ea172cf49e4] virtual merging success
xuejinghui成员
6月8日 评论:

compile

likedislike
Xxuejinghui成员
6月8日 update merge request[project id: 7649531, iid: 3167, commit_id: 4caeef93dc31baa0a29e9a51fae381509917bee7] virtual merging success
CANN-robotCANN-robot成员
6月8日 添加了label:ci-pipeline-running
CANN-robot
CANN-robot成员
6月8日 评论:

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

任务名称状态日志下载链接
Compile_Ascend_X86 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_mobile_station ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_experimental ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_experimental ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_single ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_A5 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_A5 ✅ SUCCESS >>>>> >>>>>
pre_comment ✅ SUCCESS >>>>>
Compile_Ascend_X86_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_mobile_station_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_experimental_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_A5_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_harmony-infer ✅ SUCCESS >>>>>
Compile_Ascend_ARM_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_experimental_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_single_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_A5_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_X86_monitor_910b ✅ SUCCESS >>>>> >>>>>
Compile_X86_monitor_910c ✅ SUCCESS >>>>> >>>>>
Compile_X86_monitor_950 ✅ SUCCESS >>>>> >>>>>
UT_Test ✅ SUCCESS
UT_Test_experimental ✅ SUCCESS
UT_Test_kernel ✅ SUCCESS
PreSmoke_A900 ✅ SUCCESS >>>>>
API_Check ✅ SUCCESS >>>>>
PreSmoke_ATK_Test_A2 ✅ SUCCESS >>>>>

[2026-06-08 11:06:52]    CI执行结束

likedislike
CANN-robot
CANN-robot成员
6月8日 评论:

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

任务名称状态日志下载链接
codecheck ✅ SUCCESS >>>>>
SCA ✅ SUCCESS >>>>>
antipoison ✅ SUCCESS >>>>>
codecheck_Pr ✅ SUCCESS
StaticCheck_codespell_check ✅ SUCCESS
StaticCheck_link_validity_check ✅ SUCCESS
StaticCheck_resource_existence_check ✅ SUCCESS
StaticCheck_tag_closed_check ✅ SUCCESS
StaticCheck_markdownlint ✅ SUCCESS
codecheck_codestyle ✅ SUCCESS >>>>>
codecheck_precommit ⚠️ WARNING >>>>> >>>>>

[2026-06-08 11:03:30]    CI执行结束

likedislike
CANN-robotCANN-robot成员
6月8日 添加了label:api-check-pass
CANN-robotCANN-robot成员
6月8日 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
6月8日 添加了label:ci-pipeline-passed
DaiHuina16月8日进行代码检视2
random/drop_out_do_mask_v3/examples/test_geir_drop_out_do_mask_v3.cpp
@@ -140,3 +140,3 @@
140140 }
141141 uint32_t data_len = size * GetDataTypeSize(data_type);
142- int32_t* pData = new (std::nothrow) int32_t[data_len];
142+ int64_t *pData = new (std::nothrow) int64_t[size];
DaiHuina16月8日评论:

分配内存后未delete回收,确定是否存在内存泄漏问题

likedislike
xuejinghui成员
6月9日 评论:
likedislike
DaiHuina16月8日进行代码检视2
random/drop_out_do_mask_v3/examples/test_geir_drop_out_do_mask_v3.cpp
@@ -174,0 +171,4 @@
171+ TensorDesc desc2(ge::Shape(maskShape), FORMAT_ND, ge::DT_UINT8);
172+ desc2.SetPlacement(ge::kPlacementHost);
173+ desc2.SetFormat(FORMAT_ND);
174+ uint8_t *mask_data = new (std::nothrow) uint8_t[128];
DaiHuina16月8日评论:

分配内存后未释放,内存溢出风险

likedislike
xuejinghui成员
6月9日 评论:
likedislike
DaiHuina16月8日进行代码检视2
random/random_standard_normal_v2/examples/test_geir_random_standard_normal_v2.cpp
已过期
@@ -27,3 +27,3 @@
2727#include "ge_ir_build.h"
2828 
29-#include "experiment_ops.h"
29+// #include "experiment_ops.h"
DaiHuina16月8日评论:

冗余代码删除

likedislike
System
系统消息系统
6月9日 评论:
likedislike
DaiHuina16月8日进行代码检视2
random/random_uniform_int_v2/examples/test_geir_random_uniform_int_v2.cpp
已过期
@@ -27,3 +27,3 @@
2727#include "ge_ir_build.h"
2828 
29-#include "experiment_ops.h"
29+// #include "experiment_ops.h"
DaiHuina16月8日评论:

冗余代码删除

likedislike
System
系统消息系统
6月9日 评论:
likedislike
DaiHuina16月8日进行代码检视2
random/truncated_normal_v2/examples/test_geir_truncated_normal_v2.cpp
已过期
@@ -27,3 +27,3 @@
2727#include "ge_ir_build.h"
2828 
29-#include "experiment_ops.h"
29+// #include "experiment_ops.h"
DaiHuina16月8日评论:

冗余代码删除

likedislike
System
系统消息系统
6月9日 评论:
likedislike
Xxuejinghui成员
6月9日 修改标题为 “fix: 修复random类算子example的编译和运行问题”,原标题为“fix: 修复random_standard_normal_v2和random_uniform_int_v2 example中GenOnesData的int64数据写入bug”
Xxuejinghui成员
6月9日 修改了pull request 的描述
Xxuejinghui成员
6月9日 update merge request[project id: 7649531, iid: 3167, commit_id: 2113e9be2324452ac18ebf9d9962e2834b754ccf] virtual merging success
Xxuejinghui成员
6月9日 强制推送  1 个提交:2473229b-fix: 修复random类算子example的编译和运行问题
Xxuejinghui成员
6月9日 update merge request[project id: 7649531, iid: 3167, commit_id: c18ce570447d4ed6d61b7f254f15eb909e4c1ac1] virtual merging success
CANN-robotCANN-robot成员
6月9日 删除了label:ci-pipeline-passed
CANN-robot
CANN-robot成员
6月9日 评论:

Notification

This pull request has been changed(code update) or closed, so removes the following label(s): ci-pipeline-passed.

likedislike
Xxuejinghui成员
6月9日 解决了最后一个问题
xuejinghui成员
6月9日 评论:

compile

likedislike
Xxuejinghui成员
6月9日 update merge request[project id: 7649531, iid: 3167, commit_id: 575862fe9732bd1f91636f6339a2549e8876319e] virtual merging success
CANN-robotCANN-robot成员
6月9日 删除了label:api-check-pass
CANN-robotCANN-robot成员
6月9日 添加了label:ci-pipeline-running
CANN-robot
CANN-robot成员
6月9日 评论:

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

任务名称状态日志下载链接
Compile_Ascend_X86 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_mobile_station ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_experimental ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_experimental ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_single ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_A5 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_A5 ✅ SUCCESS >>>>> >>>>>
pre_comment ✅ SUCCESS >>>>>
Compile_Ascend_X86_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_mobile_station_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_experimental_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_A5_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_harmony-infer ✅ SUCCESS >>>>>
Compile_Ascend_ARM_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_experimental_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_single_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_A5_ubuntu24 ✅ SUCCESS >>>>> >>>>>
Compile_X86_monitor_910b ✅ SUCCESS >>>>> >>>>>
Compile_X86_monitor_910c ✅ SUCCESS >>>>> >>>>>
Compile_X86_monitor_950 ✅ SUCCESS >>>>> >>>>>
UT_Test ✅ SUCCESS
UT_Test_experimental ✅ SUCCESS
UT_Test_kernel ✅ SUCCESS
PreSmoke_A900 ✅ SUCCESS >>>>>
API_Check ✅ SUCCESS >>>>>
PreSmoke_ATK_Test_A2 ✅ SUCCESS >>>>>

[2026-06-09 09:58:41]    CI执行结束

likedislike
CANN-robot
CANN-robot成员
6月9日 评论:

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

任务名称状态日志下载链接
codecheck ✅ SUCCESS >>>>>
SCA ✅ SUCCESS >>>>>
antipoison ✅ SUCCESS >>>>>
codecheck_Pr ✅ SUCCESS
StaticCheck_codespell_check ✅ SUCCESS
StaticCheck_link_validity_check ✅ SUCCESS
StaticCheck_resource_existence_check ✅ SUCCESS
StaticCheck_tag_closed_check ✅ SUCCESS
StaticCheck_markdownlint ✅ SUCCESS
codecheck_codestyle ✅ SUCCESS >>>>>
codecheck_precommit ⚠️ WARNING >>>>> >>>>>

[2026-06-09 09:56:25]    CI执行结束

likedislike
CANN-robotCANN-robot成员
6月9日 添加了label:api-check-pass
CANN-robotCANN-robot成员
6月9日 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
6月9日 添加了label:ci-pipeline-passed
songkai111成员
6月9日 评论:

/lgtm
/approve

likedislike
CANN-robotCANN-robot成员
6月9日 添加了label:approved
RuiWang_成员
6月9日 评论:

/approve

likedislike
CANN-robotCANN-robot成员
6月9日 添加了label:lgtm
CANN-robotCANN-robot成员
6月9日 关闭了关联的issue
CANN-robotCANN-robot成员
6月9日 合入了pull request