Skip to content

[API] Fix paddle.unique return_inverse shape to align with numpy/torch when axis=None#78125

Open
NJX-njx wants to merge 1 commit intoPaddlePaddle:developfrom
NJX-njx:fix/issue-72822-unique-inverse-shape
Open

[API] Fix paddle.unique return_inverse shape to align with numpy/torch when axis=None#78125
NJX-njx wants to merge 1 commit intoPaddlePaddle:developfrom
NJX-njx:fix/issue-72822-unique-inverse-shape

Conversation

@NJX-njx
Copy link

@NJX-njx NJX-njx commented Mar 3, 2026

关联 Issue

Fixes #72822

问题描述

paddle.unique 在 axis=None、return_inverse=True 时,返回的 inverse 被 flatten 成一维,而 numpy 和 torch 会保持输入的原形状。

修复计划

  • 修改 paddle.unique 实现,使 return_inverse 在 axis=None 时保持输入形状
  • 与 PyTorch/NumPy 行为对齐,便于模型迁移

说明

本 PR 为 Draft 状态,待补充具体代码修改后更新。

Made with Cursor

Copilot AI review requested due to automatic review settings March 3, 2026 12:48
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@paddle-bot
Copy link

paddle-bot bot commented Mar 3, 2026

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@paddle-bot paddle-bot bot added the contributor External developers label Mar 3, 2026
@luotao1 luotao1 added the HappyOpenSource 快乐开源活动issue与PR label Mar 4, 2026
@luotao1 luotao1 self-assigned this Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor External developers HappyOpenSource 快乐开源活动issue与PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

paddle.unique 在 axis=None,return_inverse = True时,返回的 inverse shape 与 numpy 和 torch 不一致

3 participants