- PyPTO codegen 模块日志整改
- Issue:2824问题修改
- Issue:3020问题修改


Pull Request has been successfully merged by CANN-robot.
(Thank you for anyangle's contribution.)变更摘要
本 PR 修复了 framework/src/codegen/codegen_op.h 中 operandWithMagic 的越界初始化问题。此前的写法使用 reserve(MAX_OPERANDS) 仅预留容量而不改变向量大小,随后循环中直接对 operandWithMagic[i] 赋值可能产生越界访问;本改动改为使用 resize(MAX_OPERANDS, INVALID_TENSOR_MAGIC),一次性将向量扩展为 MAX_OPERANDS 个元素并统一初始化为 INVALID_TENSOR_MAGIC,从而消除了越界风险。
主要改动
- 改用
resize初始化: 将operandWithMagic.reserve(MAX_OPERANDS)替换为operandWithMagic.resize(MAX_OPERANDS, INVALID_TENSOR_MAGIC),使向量真正分配并填充MAX_OPERANDS个默认元素,避免后续按索引赋值时越界。 - 移除循环内的重复赋值: 删除构造函数循环中的
operandWithMagic[i] = INVALID_TENSOR_MAGIC;,因resize已用INVALID_TENSOR_MAGIC完成初始化,无需在循环中再次赋值。 - 保留其余初始化逻辑: 循环中对
operandType[i]、operandDtype[i]的初始化保持不变,仅调整了operandWithMagic相关的初始化方式。


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 |
|---|---|---|
| docs | ✅ 尹杰, lululu40888, lyz0328 (3/2) | ✅ lyz0328, 尹杰 (2/1) |
| framework/src/codegen | ✅ lululu40888, 尹杰 (2/2) | ✅ 尹杰, lululu40888 (2/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
quadrate, thanks for your pull request. All authors of the commits have signed the CLA. 👍


/check-pr


The following labels are not ready.
lgtm: Please wait for reviewers to review the code.
approved: Please wait for committers to review the code.


/approve

