Skip to content

[API Compability NO.59] use ChangePrefixMatcher for torch.diagflat -part#853

Open
HaolinGuan7211 wants to merge 1 commit intoPaddlePaddle:masterfrom
HaolinGuan7211:compability/api59-diagflat-changeprefix
Open

[API Compability NO.59] use ChangePrefixMatcher for torch.diagflat -part#853
HaolinGuan7211 wants to merge 1 commit intoPaddlePaddle:masterfrom
HaolinGuan7211:compability/api59-diagflat-changeprefix

Conversation

@HaolinGuan7211
Copy link

@HaolinGuan7211 HaolinGuan7211 commented Mar 12, 2026

PR Category

User Experience

PR Types

New Features

Description

torch.diagflat 的转换规则调整为 ChangePrefixMatcher,满足 API 59 的验收要求。

本次改动包括:

  1. torch.diagflat 的 matcher 从 GenericMatcher 调整为 ChangePrefixMatcher
  2. 不再依赖 kwargs_changeinput 改写为 x
  3. 保持转换结果为仅修改前缀的形式,例如:
    • torch.diagflat(input=x, offset=-3)
    • paddle.diagflat(input=x, offset=-3)
  4. 补充和调整 diagflat 相关测试,覆盖 input= 用法、负 offset、关键字顺序变化以及 scalar 输入场景。

说明:

  1. 本 PR 依赖 Paddle 侧已支持 paddle.diagflat(input=...)
  2. 本 PR 仅调整 PaConvert 转换策略与测试,不涉及 Paddle 底层算子行为修改;
  3. 当前 bool dtype 与 PyTorch 的底层行为差异不在本 PR 处理范围内。

是否引起精度变化

Ref comment:
PaddlePaddle/Paddle#76301 (comment)

@paddle-bot
Copy link

paddle-bot bot commented Mar 12, 2026

Thanks for your contribution!

@paddle-bot paddle-bot bot added the contributor External developers label Mar 12, 2026
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@HaolinGuan7211 HaolinGuan7211 changed the title Use ChangePrefixMatcher for torch.diagflat [API Compability] Use ChangePrefixMatcher for torch.diagflat Mar 12, 2026
@HaolinGuan7211 HaolinGuan7211 changed the title [API Compability] Use ChangePrefixMatcher for torch.diagflat [API Compability] use ChangePrefixMatcher for torch.diagflat Mar 12, 2026
@HaolinGuan7211 HaolinGuan7211 changed the title [API Compability] use ChangePrefixMatcher for torch.diagflat [API Compability NO.59] use ChangePrefixMatcher for torch.diagflat -part Mar 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor External developers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants