-
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
【Infer Symbolic Shape No.125】【BUAA】Add BroadcastTensor, changed 3 files #67744
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
std::vector<symbol::DimExpr> out_shape; | ||
for (size_t i = 0; i < target_rank; i++) { | ||
out_shape.push_back(symbol::DimExpr{1}); | ||
} | ||
|
||
symbol::DimExprBuilder builder; | ||
for (size_t i = 0; i < input_shape_or_data_list.size(); i++) { | ||
size_t tmp_bound = input_shape_or_data_list[i].shape().size(); | ||
for (size_t j = 0; j < tmp_bound; j++) { | ||
out_shape[target_rank - j - 1] = builder.Broadcast( | ||
input_shape_or_data_list[i].shape()[tmp_bound - j - 1], | ||
out_shape[target_rank - j - 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.
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.
需要从最后一个维度往前做broadcast比对,每个tensor长度不一样,如果长度短,前面缺的用1补全,那么最内层for循环每次都需要判断shape_or_data_list[j]的长度,这样可以吗?
} | ||
|
||
symbol::TensorListShapeOrDataDimExprs out_shapes; | ||
for (size_t i = 0; i < target_rank; i++) { |
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.
i < input_shape_or_data_list.size()
PR Category
CINN
PR Types
Others
Description
加入broadcast_tensors:
paddle/fluid/pir/dialect/operator/interface/infer_symbolic_shape/multiary_infer_sym.cc
paddle/fluid/pir/dialect/operator/interface/infer_symbolic_shape/multiary_infer_sym.h
paddle/phi/ops/yaml/ops.yaml