Pull Request已成功合入, 合并人@CANN-robot
(感谢 wushuai 的贡献)变更摘要
此 PR 主要对 aclnn_random.cpp 中的随机数算子进行了三方面的改进:为 RegBase 平台引入独立的数据类型校验列表(排除复数类型)、在有区间参数的 GetWorkspaceSize 函数中新增 Contiguous 预处理确保 tensor 内存连续性、以及将四个 GetWorkspaceSize 函数的输出操作统一使用提前捕获的 out 变量(原始 tensor)完成 CastProcess 和 ViewCopy,使计算路径和写回路径解耦。
主要改动
-
新增
REGBASE_DTYPE_SUPPORT_LIST及条件类型校验: 新增一个不包含DT_COMPLEX64和DT_COMPLEX128的数据类型支持列表,CheckDtypeValid函数根据IsRegBase()返回值选择使用REGBASE_DTYPE_SUPPORT_LIST或原有的DTYPE_SUPPORT_LIST,以适配 RegBase 平台不支持复数类型的场景。 -
aclnnInplaceRandomGetWorkspaceSize与aclnnInplaceRandomTensorGetWorkspaceSize新增Contiguous调用: 在这两个函数中,通过l0op::Contiguous(selfRef, ...)获取连续内存的 tensor(selfContiguous),后续的GetDataType、GetViewShape、randomDavidPath/randomTensorDavidPath等计算操作均基于selfContiguous,避免非连续 tensor 导致的计算异常。 -
输出操作统一使用原始 tensor(
out): 四个GetWorkspaceSize函数均在开头通过auto out = const_cast<aclTensor*>(selfRef)捕获原始输出 tensor,CastProcess和ViewCopy等最终写回操作统一基于out,而非selfContiguous或直接使用selfRef,使计算过程与输出目标分离。


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 | ✅ 陈娇, xuejinghui (2/2) | ✅ 陈娇 (1/1) |
| repo-cann/ops-math | ✅ xuejinghui, 宋恺 (2/2) | ✅ xuejinghui, 宋恺 (2/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
wu-shuai2580, thanks for your pull request. All authors of the commits have signed the CLA. 👍


/approve


描述
aclnnRandom支持非连续
关联的Issue
测试
冒烟pass、用例测试pass
文档更新
random/dsa_random_uniform/docs/aclnnInplaceRandomTensor.md
类型标签