-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
【BUAA】【Infer Symbolic Shape】添加 weight_only_linear op的符号推导接口 #67875
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
标题修改一下,添加 weight_only_linear op的符号推导接口 |
auto weight_scale_shape = weight_scale_shape_or_data.shape(); | ||
auto x_shape = x_shape_or_data.shape(); | ||
auto weight_shape = weight_shape_or_data.shape(); | ||
auto n = group_size == -1 ? weight_scale_shape[0] : weight_scale_shape[1]; |
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.
直接写明类型,尽量不使用auto
// 0, | ||
// common::errors::InvalidArgument( | ||
// "The second dimension of input must be divisible by 16, but | ||
// got[%d]", weight_shape[1])); |
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.
把这两个Enforce的注释删了,修改成TODO项
"Input(X) dim[-1] and Input(Weight) dim[1] should be equal." | ||
"But received Input(X) dim[-1](%s) != Input(Weight) dim[1](%s)", | ||
x_shape[x_shape.size() - 1], | ||
weight_shape[1])); |
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.
应该使用equalcstr
x_shape[x_shape.size() - 1], | ||
weight_shape[1])); | ||
if (!bias_shape_or_data.isa<symbol::NullShapeOrDataDimExpr>()) { | ||
auto bias_shape = bias_shape_or_data.shape(); |
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.
auto同上
"The input(weight_scale) must be a 2D Tensor" | ||
" in groupwise mode.")); | ||
PADDLE_ENFORCE_EQ(weight_scale_shape[0], | ||
(weight_shape[1] + (group_size - 1)) / group_size, |
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.
同上DIm的约束应该使用equalcstr
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.
approved,const &的问题可以放后面的PR修改
|
||
ExprVec weight_scale_shape = weight_scale_shape_or_data.shape(); | ||
ExprVec x_shape = x_shape_or_data.shape(); | ||
ExprVec weight_shape = weight_shape_or_data.shape(); |
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.
能用 const & 尽量用,避免copy
PR Category
CINN
PR Types
Others
Description
增加了新的符号推导
测试位于test_weight_only_linear.py 缺失optest
约束信息暂未修改,沿用了infermeta的PADDLE_ENFORCE