-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Conversation
Thanks for your contribution! |
} | ||
|
||
template <typename T, typename Context> | ||
void HierarchicalSigmoidGradKernel(const Context& ctx, |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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。所以要复用的话,需要再封装个辅助函数,返回这个值,最后计算。开始考虑到逻辑复杂性就先没写,这个后面我在实现下
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果重复代码量太多,建议后边还是逻辑再封装一下吧
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
PR types
Others
PR changes
Others
Describe
[Phi]Move hierarchical_sigmoid kernel to phi