KEMBAR78
[API Compatibility] add out for `topk` by aquagull · Pull Request #74887 · PaddlePaddle/Paddle · GitHub
Skip to content

Conversation

@aquagull
Copy link
Contributor

@aquagull aquagull commented Aug 26, 2025

PR Category

User Experience

PR Types

Others

Description

topk增加别名装饰器,使用assign来实现out参数;amax amin在之前已经完成了下沉,这个pr补充文档、单测
image
image

pcard-71500

@paddle-bot
Copy link

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

@codecov-commenter
Copy link

Codecov Report

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

Additional details and impacted files
@@             Coverage Diff             @@
##             develop    #74887   +/-   ##
===========================================
  Coverage           ?   100.00%           
===========================================
  Files              ?         1           
  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.

@aquagull
Copy link
Contributor Author

/re-run all-failed

@aquagull aquagull changed the title Test ci [API Compatibility] add out for topk Aug 27, 2025
zhwesky2010
zhwesky2010 previously approved these changes Aug 27, 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

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

out_values, out_indices = out
out_values = paddle.assign(values, output=out_values)
out_indices = paddle.assign(indices, output=out_indices)
return out_values, out_indices
Copy link
Contributor

@zhwesky2010 zhwesky2010 Aug 27, 2025

Choose a reason for hiding this comment

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

下个PR可以看下这个返回类型的问题:torch的返回类型是torch.return_types.topk

我们针对这个也封装了相应数据结构:https://github.com/PaddlePaddle/Paddle/blob/develop/python/paddle/tensor/compat.py#L222

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:#74931

@zhwesky2010 zhwesky2010 merged commit 94dc71c into PaddlePaddle:develop Aug 27, 2025
52 checks passed
@aquagull aquagull deleted the other 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