Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Phi] Move softmax with cross entropy kernel into phi #40832

Conversation

chenwhql
Copy link
Contributor

@chenwhql chenwhql commented Mar 22, 2022

PR types

Function optimization

PR changes

OPs

Describe

[Phi] Move softmax with cross entropy kernel into phi

  1. softmax_with_cross_entropy op现在对应的Python API是cross_entropy,因此kernel文件命名为cross_entropy_kernel.*
  2. softmax_with_cross_entropy op名不符实,现在它的行为是一个可以选择是否先进行softmax计算,再进行cross_entropy计算,cross_entropy计算是一定有的,而softmax不一定计算,因此将kernel更名为cross_entropy_with_softmax,实际上这也只是一种特殊的cross_entropy运算而已
  3. 前向CPU kernel有存在显而易见的冗余代码,整合了重复代码,进行了简化封装
  4. 内部调用函数保持原命名,未进行更改,有必要后续再进行,仅kernel名进行了调整

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

@chenwhql chenwhql merged commit e6ec98f into PaddlePaddle:develop Apr 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants