Skip to content

Conversation

@Enigmatisms
Copy link
Contributor

@Enigmatisms Enigmatisms commented Oct 30, 2025

PR Category

Operator Mechanism

PR Types

New features

Description

Torch 兼容的 paddle.compat.nn.functional.linear。实现是 _C_ops.matmul (transpose_y = True) + _C_ops.add。PaConvert 已通过。性能数据(与torch对比):

统计信息:
平均前向加速比: 1.10x
平均反向加速比: 1.11x
平均总加速比: 1.08x
最佳性能案例: 极小尺寸-有偏置 (加速比: 1.39x)
最差性能案例: 高维输入-有偏置 (加速比: 0.61x)

偏置对性能影响:
有偏置案例平均加速比: 0.97x
无偏置案例平均加速比: 1.19x
偏置带来的性能差异: -0.22x

维度对性能影响:
2D输入平均加速比: 1.14x
3D输入平均加速比: 0.99x
4D输入平均加速比: 1.01x
5D输入平均加速比: 1.18x

此外,调整了:

引入的 paddle.compat.softmaxpaddle.softmax 已经存在,并且基于 compat_softmax,所以 paddle.compat.softmax 没有存在的必要。还调整了一下几个 __init__.py 的 import 格式。

Pcard-89620

@paddle-bot
Copy link

paddle-bot bot commented Oct 30, 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-commenter commented Oct 30, 2025

Codecov Report

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

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

@Enigmatisms Enigmatisms force-pushed the linear_api branch 2 times, most recently from c4cb857 to e730ba8 Compare October 31, 2025 03:21
paddle.compat.softmax is removed

Adjust some of the import line position
@Enigmatisms Enigmatisms changed the title [API Compatibility] Add paddle.compat.nn.functional.linear [API Compatibility] Add paddle.compat.nn.functional.linear and remove paddle.compat.softmax Oct 31, 2025
SigureMo
SigureMo previously approved these changes Oct 31, 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

@XiaoguangHu01 XiaoguangHu01 left a comment

Choose a reason for hiding this comment

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

LGTM

@Enigmatisms Enigmatisms merged commit 84d14f8 into PaddlePaddle:develop Nov 1, 2025
91 of 94 checks passed
@Enigmatisms Enigmatisms deleted the linear_api branch November 1, 2025 02:00
@zhwesky2010 zhwesky2010 changed the title [API Compatibility] Add paddle.compat.nn.functional.linear and remove paddle.compat.softmax [API Compatibility] Add paddle.compat.nn.functional.linear Nov 3, 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