-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
add quant_linear #57852
add quant_linear #57852
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
phi::QuantLinearKernel, | ||
float, | ||
double, | ||
phi::dtype::float16) {} |
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.
也需要支持bfloat16
int in_num_col_dims, | ||
const std::string& activation_type, | ||
bool padding_weights, | ||
bool is_quant, |
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.
算子名称已经是QuantLinear 这个参数是否有必要保留
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.
那后续删掉这个参数,算子改为只支持quant。
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描述里写上op的运行方式以及应用场景吧~ |
case 4: | ||
QuantKernelWithVecSize<<<grid, block, 0, stream>>>( | ||
input, | ||
(char4*)output, // NOLINT |
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.
是不是还是用reinterpret_cast好一些
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.
float quant_max_bound, | ||
float quant_min_bound, | ||
DenseTensor* y) { | ||
bool with_relu = activation_type == "relu" ? true : false; |
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.
对于给入非relu的激活, 好像没有做处理?
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.
目前是只支持relu激活,在InferMeta里对activation_type 非relu的情况做了检查。
be created according to ParamAttr. For detailed information, please refer | ||
to :attr:`paddle.ParamAttr`. The default value is None and the bias will be | ||
initialized to zero. | ||
activation (str, optional): Activation to be applied to the output of |
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.
文档这里可能需要写明给出已支持的activation方法列表
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.
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.
LGTM
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.
LGTM
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.
LGTM for unittest.skipIf
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.
LGTM for check_dygaph
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.
考虑到API后续可能会被修改,建议先作为内部API
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.
LGTM for docs
* move fc to phi
hi, @YSF-A
|
* move fc to phi
PR types
New features
PR changes
OPs
Description
add quant_linear
输入input、bias与in8的w,以及quant scale、round_type、max_bound、min_bound等量化相关的参数,可以计算获得output。其中,input量化为layer_wise,w量化为channel_wise。
应用场景是用于需要量化的Linear的场景。