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 hierarchical_sigmoid kernel to phi #40553

Merged
merged 14 commits into from
Mar 18, 2022

Conversation

ZzSean
Copy link
Contributor

@ZzSean ZzSean commented Mar 15, 2022

PR types

Others

PR changes

Others

Describe

[Phi]Move hierarchical_sigmoid kernel to phi

@paddle-bot-old
Copy link

Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

}

template <typename T, typename Context>
void HierarchicalSigmoidGradKernel(const Context& ctx,
Copy link
Contributor

Choose a reason for hiding this comment

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

selected_rows 的kernel代码和DenseTensor的看上去几乎相同,这里是否可以复用DenseTensor的kernel?

Copy link
Contributor Author

@ZzSean ZzSean Mar 17, 2022

Choose a reason for hiding this comment

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

这个尝试过,但是selectrows最后计算的时候还用到了selectrows的tensor,
bit_code->MulGradWeight(pre_out_grad, w_grad, x);
这里pre_out_grad是计算得到的,w_grad是selectrow。所以要复用的话,需要再封装个辅助函数,返回这个值,最后计算。开始考虑到逻辑复杂性就先没写,这个后面我在实现下

Copy link
Contributor

Choose a reason for hiding this comment

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

如果重复代码量太多,建议后边还是逻辑再封装一下吧

Copy link
Contributor Author

Choose a reason for hiding this comment

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

好的

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@ZzSean ZzSean merged commit 64a7cbd into PaddlePaddle:develop Mar 18, 2022
@ZzSean ZzSean deleted the move_hsigmoid branch April 14, 2022 08:57
@ZzSean ZzSean restored the move_hsigmoid branch April 14, 2022 08:57
@ZzSean ZzSean deleted the move_hsigmoid branch April 14, 2022 09:00
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