Skip to content

Conversation

@aquagull
Copy link
Contributor

@aquagull aquagull commented Aug 27, 2025

PR Category

User Experience

PR Types

Others

Description

add return_type for topk and fix compat.median 's return_type
cc @zhwesky2010
pcard-71500

@paddle-bot
Copy link

paddle-bot bot commented Aug 27, 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.

@aquagull aquagull changed the title Topk add return_type for topk Aug 27, 2025
@codecov-commenter
Copy link

Codecov Report

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

Additional details and impacted files
@@             Coverage Diff             @@
##             develop    #74931   +/-   ##
===========================================
  Coverage           ?   100.00%           
===========================================
  Files              ?         2           
  Lines              ?         9           
  Branches           ?         0           
===========================================
  Hits               ?         9           
  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.

@zhwesky2010 zhwesky2010 changed the title add return_type for topk [API Compatibilities] add return_type for topk Aug 28, 2025
Copy link
Contributor

@zhwesky2010 zhwesky2010 left a comment

Choose a reason for hiding this comment

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

LGTM

@zhwesky2010 zhwesky2010 requested a review from SigureMo August 28, 2025 04:33
sorted: bool = True,
name: str | None = None,
*,
out: tuple[Tensor, Tensor] | None = None,
Copy link
Member

Choose a reason for hiding this comment

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

确认一下,这里的 out 的类型和输出不是一样的么?

Copy link
Member

Choose a reason for hiding this comment

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

median 同样

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. 这个out是由用户传进来的,类型可以不是Namedtuple,但输出一定是Namedtuple。
  2. torch的文档中也只是表明这个out参数得是(Tensor, Tensor),并没有更进一步的要求。

可能写out=None更好些?

Copy link
Contributor

@zhwesky2010 zhwesky2010 Aug 28, 2025

Choose a reason for hiding this comment

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

median 同样

不是一样的,median、sort、min、max、topk这几个返回的都是两个Tensor,都像torch一样封装了返回类型。

@zhwesky2010 zhwesky2010 merged commit 85e0394 into PaddlePaddle:develop Aug 28, 2025
75 of 78 checks passed
@aquagull aquagull deleted the topk branch September 12, 2025 03:10
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.

4 participants