Skip to content

Conversation

@cyy536
Copy link
Contributor

@cyy536 cyy536 commented Aug 16, 2025

PR Category

User Experience

PR Types

New features

Description

ignore _stacklevel, make ​​parameter name​​ compatible with input and dim, support paddle.softmax, paddle.Tensor.softmax

@paddle-bot
Copy link

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

# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

Copy link
Contributor

Choose a reason for hiding this comment

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

单独把这个softmax挪出来,我感觉似乎不太合理,这个循环导入问题,还有其他一些解决方式没。

或者tensor目录下面,是不是更合理点

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已经放在tensor目录下


@ParamAliasDecorator({"x": ["input"], "axis": ["dim"]})
@ParamIgnoreDecorator([('_stacklevel', 2, int)])
def softmax(
Copy link
Contributor

Choose a reason for hiding this comment

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

这个装饰器太多了,对性能影响比较大,你可以优化下装饰器的写法,至多走一个装饰器,尽可能减少判断逻辑与分支,每次if else都有损耗

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个,内部逻辑应该不能再简化了

@cyy536
Copy link
Contributor Author

cyy536 commented Aug 19, 2025

/re-run all-failed

@codecov-commenter
Copy link

codecov-commenter commented Aug 19, 2025

Codecov Report

❌ Patch coverage is 94.00000% with 3 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (develop@00f6730). Learn more about missing BASE report.

Files with missing lines Patch % Lines
python/paddle/tensor/softmax.py 93.33% 2 Missing ⚠️
python/paddle/utils/decorator_utils.py 94.11% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             develop   #74651   +/-   ##
==========================================
  Coverage           ?   94.00%           
==========================================
  Files              ?        5           
  Lines              ?       50           
  Branches           ?        0           
==========================================
  Hits               ?       47           
  Misses             ?        3           
  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.

return args, kwargs


def ParamIgnoreAndAliasDecorator(
Copy link
Contributor

Choose a reason for hiding this comment

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

命名风格与其他的保持统一吧,function采用下划线,class采用驼峰式。你可以下个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.

这个我后面再提个pr,修改一下

@zhwesky2010 zhwesky2010 requested a review from SigureMo August 20, 2025 10:33
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

@cyy536
Copy link
Contributor Author

cyy536 commented Aug 21, 2025

/re-run all-failed

@zhwesky2010 zhwesky2010 merged commit d1c8a43 into PaddlePaddle:develop Aug 21, 2025
139 of 157 checks passed
Luckycheng222 pushed a commit to Luckycheng222/Paddle that referenced this pull request Aug 25, 2025
… dim, support paddle.softmax, paddle.Tensor.softmax (PaddlePaddle#74651)

* ignore _stacklevel, make ​​parameter name​​ compatible with input and dim

* import softmax in activation.py

* mv paddle/softmax to tensor/softmax; merge two decorators into one

* fix pre-commit

* fix import path

* fix the logic, replace Class with Function
@zhwesky2010 zhwesky2010 changed the title ignore _stacklevel, make ​​parameter name​​ compatible with input and dim, support paddle.softmax, paddle.Tensor.softmax [API compatibility] ignore _stacklevel, make ​​parameter name​​ compatible with input and dim, support paddle.softmax, paddle.Tensor.softmax Sep 5, 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