Pull Request已成功合入, 合并人@CANN-robot
(感谢 pan xiong 的贡献)变更摘要
本 PR 主要围绕 legacy 日落 阶段的剩余算子做收尾改造:为一批转换类与数学类算子补齐数据类型推导能力,并统一补充日志输出。改动以 op_host 下的 infershape 与 arch35 tiling 实现为主,通过新增 InferDataType 函数并注册到 IMPL_OP_INFERSHAPE(...) 链式调用中,使算子输出数据类型与输入保持一致;同时为多个算子新增/扩展输出 shape 与 TilingData 字段日志,新增两个梯度算子的 shape 推导实现,整体属于算子泛化与可观测性增强。
主要改动
-
补齐剩余算子的
InferDataType注册:为BatchToSpace、DiagFlat、DiagV2、SliceLastDim、SliceWithAxes、SpaceToBatch、SpaceToBatchND、TileWithAxis、Xdivy、Xlog1py、Xlogy等算子新增InferDataType4Xxx函数,并通过InferShape(...).InferDataType(...)注册,使输出数据类型继承输入数据类型。 -
新增两个梯度算子的 shape 推导实现:新增
circular_pad_grad_infershape.cpp与pad_v3_grad_replication_infershape.cpp,根据输入x的 shape 与paddings常量计算输出 shape(减去各维 padding),并处理未知 rank/未知 paddings、校验paddings元素个数及输出维度非负,同时注册InferDataType与InputsDataDependency({INPUT_IDX_PADDINGS})。 -
统一补充 tiling 入口日志:在
BatchToSpace、CircularPadGrad、DiagFlat、DiagV2、PadV3GradReplication、SliceLastDim、SliceWithAxes、SpaceToBatch、SpaceToBatchND、TileWithAxis、DataCompare、Xdivy、Xlog1py、Xlogy等算子的arch35tiling 函数入口统一新增OP_LOGD(..., "Begin the tiling process for Arch35 architecture")。 -
扩展 TilingData 与输出 shape 的详细日志:新增
LogTilingData辅助函数或内联OP_LOGI,打印如DataCompare、DiagV2、TileWithAxis、SpaceToBatchND、PadV3GradReplication等算子的完整 TilingData 字段,并在各infershape中调用Ops::Base::ToString打印输出 shape。 -
引入
util/shape_util.h并整理代码:多个infershape文件新增#include "util/shape_util.h"以支持 shape 打印,同时清理部分文件的行尾换行符与末尾换行问题(如slice_last_dim_infershape.cpp、diag_v2_infershape.cpp)。


Hi @pan_xiong, welcome to submitting your first PR to ops-math!
PR Merge Steps
1. CLA Signing
If the current PR label includes cann-cla/yes, it means you have signed the CLA and can proceed to the next step. If the label includes cann-cla/no, please sign the CLA first. If you have any questions, please refer to the FAQ.
2. CI Check
Please comment /compile to trigger the CI pipeline check. If the CI run is successful, the PR will be tagged with ci-pipeline-passed and you can proceed to the next step. If the CI run fails, the PR will be tagged with ci-pipeline-failed, please check the CI logs to fix the issues in the PR. If you have any questions, please refer to the FAQ.
3. Code Review
After CI passes, please refer to the PR Approval Progress and proactively @ the committers in the table to review the code. After approval, committers will comment /lgtm and /approve. Once the lgtm and approved labels are successfully added, the PR will be merged automatically.


描述
legacy日落-给一些算子增加InferDataTpye、Infershape打印outputshape和Tiling日志
关联的Issue
https://gitcode.com/cann/ops-math/issues/2801
测试
二级冒烟、本地通路验证完毕
文档更新
暂无文档更新
类型标签