Skip to content

Conversation

@co63oc
Copy link
Contributor

@co63oc co63oc commented Nov 13, 2025

PR Category

User Experience

PR Types

New features

Description

paddle.unique 兼容性修改
返回数据可能为数组或一项,使用装饰器方式修改
sorted 参数不影响返回结果,结果始终是排序,增加参数保持兼容性

@paddle-bot
Copy link

paddle-bot bot commented Nov 13, 2025

你的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 Nov 13, 2025
@co63oc co63oc changed the title CI测试不review add api compatibility for paddle.unique [fluid_ops] 【Hackathon 9th No.1】 add api compatibility for paddle.unique -part [fluid_ops] Nov 13, 2025
@co63oc co63oc changed the title 【Hackathon 9th No.1】 add api compatibility for paddle.unique -part [fluid_ops] 【Hackathon 9th No.1】 add api compatibility for paddle.unique - part [fluid_ops] Nov 13, 2025
@co63oc co63oc changed the title 【Hackathon 9th No.1】 add api compatibility for paddle.unique - part [fluid_ops] add api compatibility for paddle.unique - part [fluid_ops] Nov 13, 2025
@co63oc co63oc changed the title add api compatibility for paddle.unique - part [fluid_ops] [API compatibility] add api compatibility for paddle.unique - part [fluid_ops] Nov 13, 2025
@co63oc co63oc changed the title [API compatibility] add api compatibility for paddle.unique - part [fluid_ops] 【Hackathon 9th Sprint No.1】add api compatibility for paddle.unique - part [fluid_ops] Nov 13, 2025
@codecov-commenter
Copy link

codecov-commenter commented Nov 13, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (develop@3e93582). Learn more about missing BASE report.

Additional details and impacted files
@@             Coverage Diff             @@
##             develop    #76387   +/-   ##
===========================================
  Coverage           ?   100.00%           
===========================================
  Files              ?         1           
  Lines              ?         5           
  Branches           ?         0           
===========================================
  Hits               ?         5           
  Misses             ?         0           
  Partials           ?         0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@co63oc
Copy link
Contributor Author

co63oc commented Nov 14, 2025

/re-run all-failed

@co63oc
Copy link
Contributor Author

co63oc commented Nov 14, 2025

/re-run all-failed

@co63oc
Copy link
Contributor Author

co63oc commented Nov 14, 2025

@zhwesky2010 CI已完成需要review

Default: None.
dtype(str|paddle.dtype|np.dtype, optional): The date type of `indices` or `inverse` tensor: int32 or int64.
Default: int64.
sorted(bool, optional): Does not affect the return result, used for compatibility.
Copy link
Contributor

Choose a reason for hiding this comment

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

sorted=True
sorted=Fasle

两种情况下结果均一致吗

Copy link
Contributor Author

@co63oc co63oc Nov 14, 2025

Choose a reason for hiding this comment

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

image 是一致的,is_sorted 设置为 true image UniqueRawKernel 的参数 is_sorted 没有使用

@zhwesky2010
Copy link
Contributor

zhwesky2010 commented Nov 17, 2025

竞品有使用吗,这个任务需要做的是对齐运算结果,不用管paddle之前怎么写的。

先提交PaConvert测试吧,比对size超过1000的结果,sorted=True/False的结果比对。

@co63oc
Copy link
Contributor Author

co63oc commented Nov 17, 2025

竞品有使用吗,这个任务需要做的是对齐运算结果,不用管paddle之前怎么写的。

先提交PaConvert测试吧,比对size超过1000的结果,sorted=True/False的结果比对。

因为PaConvert的CI需要paddle合入之后测试,所以先提交这里,已增加PaConvert PR
PaddlePaddle/PaConvert#758
image
参数sorted=True/False测试通过

torch sorted=False时也会排序

torch.unique(torch.arange(1001, 0, -1), sorted=False)
image

@zhwesky2010
Copy link
Contributor

torch的sorted也和paddle一样不会生效吗

@co63oc
Copy link
Contributor Author

co63oc commented Nov 18, 2025

torch的sorted也和paddle一样不会生效吗

是的torch的没有生效

return_counts=False,
axis=None,
dtype="int64",
sorted=True,
Copy link
Contributor

Choose a reason for hiding this comment

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

这个目前应该无法实现 API完全一致吧,参数顺序不同。

group_norm也有这个问题。不过这个没法判断数据类型了,只能新增加一个paddle.compat.unique了?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

好的那增加paddle.compat.unique

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@zhwesky2010 已增加paddle.compat.unique CI完成,PaConvert PaddlePaddle/PaConvert#758 修改测试通过

@co63oc
Copy link
Contributor Author

co63oc commented Dec 2, 2025

/re-run all-failed

1 similar comment
@co63oc
Copy link
Contributor Author

co63oc commented Dec 2, 2025

/re-run all-failed

@co63oc
Copy link
Contributor Author

co63oc commented Dec 5, 2025

/re-run all-failed

zhwesky2010
zhwesky2010 previously approved these changes Dec 8, 2025
sorted: bool = True,
return_inverse: bool = False,
return_counts: bool = False,
dim=None,
Copy link
Member

Choose a reason for hiding this comment

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

需要添加类型提示

Copy link
Contributor Author

Choose a reason for hiding this comment

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

再提交PR加上

Copy link
Member

Choose a reason for hiding this comment

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

这个急么?为啥要等下个 PR?赶发版还是啥?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

如果修改较多,CI不容易成功,所以拆为多个PR修改

Copy link
Member

Choose a reason for hiding this comment

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

啊?这个 PR 涉及 API 变动,什么时候这个也要拆了?有这时间 CI 都过完了

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已修改

return_inverse: bool = False,
return_counts: bool = False,
dim=None,
) -> Tensor | tuple[Tensor, ...]:
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

CI容易出错,我再提交PR加上

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已修改

@co63oc
Copy link
Contributor Author

co63oc commented Dec 16, 2025

/re-run all-failed

@luotao1 luotao1 merged commit 11d80ef into PaddlePaddle:develop Dec 16, 2025
103 of 109 checks passed
@luotao1 luotao1 changed the title 【Hackathon 9th Sprint No.1】add api compatibility for paddle.unique - part [fluid_ops] 【Hackathon 9th Sprint No.1】add api compatibility for paddle.unique - part Dec 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants