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

[Semi-Auto] Add softmax infer_backward rule #56502

Merged
merged 1 commit into from
Sep 8, 2023

Conversation

pkuzyc
Copy link
Contributor

@pkuzyc pkuzyc commented Aug 21, 2023

PR types

Function optimization

PR changes

Others

Description

Pcard-70448

Add infer backward SPMD rule for softmax. It infers inputs' dims mappings as following:

For non-normalized axes, set their dims mappings equal to the outputs'. For the normalized axis, set it to -1.

@paddle-bot
Copy link

paddle-bot bot commented Aug 21, 2023

你的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.

@paddle-ci-bot
Copy link

paddle-ci-bot bot commented Sep 1, 2023

Sorry to inform you that 05ef040's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually.

// sharding on softmax_axis is not supported now, so set
// the notation on softmax_axis to '1' so that we can set
// its dim mapping to -1
x_axes[axis] = '1';
Copy link
Contributor

Choose a reason for hiding this comment

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

change the einsum_string to "1" to ensure the unsharded maybe not a good idea here, since it would disconnect the relation of softmax_axis between input and output when print the vlog for debug:

"ab1" --> "abc", later developer might not realize that axis "1" and "c" are the same axis in two tensors.

it would be better that:
first: out_dims_mapping[axis] = -1;
then: keep the input_axes unchanged.

Copy link
Contributor

@JZ-LIANG JZ-LIANG left a comment

Choose a reason for hiding this comment

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

Update in Next PR

@JZ-LIANG JZ-LIANG merged commit cf65210 into PaddlePaddle:develop Sep 8, 2023
BeingGod pushed a commit to BeingGod/Paddle that referenced this pull request Sep 9, 2023
@pkuzyc pkuzyc deleted the softmax_backward branch September 27, 2023 10:03
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.

2 participants