Repository navigation
Conversation
|
你的PR提交成功,感谢你对开源项目的贡献! |
Comment on lines
+235
to
+245
| auto cal_shape_fn = [](const symbol::DimExpr &x, | ||
| const symbol::DimExpr &y, | ||
| const std::string &error_str) -> symbol::DimExpr { | ||
| if (x == -1) { | ||
| return y; | ||
| } else if (y == -1) { | ||
| return x; | ||
| } | ||
| PADDLE_ENFORCE_EQ(x, y, common::errors::InvalidArgument(error_str, x, y)); | ||
| return x; | ||
| }; |
Collaborator
There was a problem hiding this comment.
DimExpr不可能为-1,这段逻辑是想给两个DimExpr加约束
| "in BmmOp, but received Y's shape: [%d].", | ||
| y_ndims)); | ||
|
|
||
| auto cal_shape_fn = [](const symbol::DimExpr &x, |
Contributor
There was a problem hiding this comment.
删掉这个lambda表达式,调用cal_shape_fn的地方都使用 addequalcstr
| return x; | ||
| }; | ||
|
|
||
| cal_shape_fn(x_dims[2], |
| y_dims[1], | ||
| "Input(X)'s width must be equal with Input(Y)'s height in " | ||
| "BmmOp, but receive X's width: [%d], Y's height: [%d]."); | ||
| symbol::DimExpr batch_size = cal_shape_fn( |
Contributor
There was a problem hiding this comment.
同上,batch_size 直接取其中一个Dim就行
| const auto &y_shape_or_data = | ||
| infer_context->GetShapeOrDataForValue(op->operand_source(1)); | ||
|
|
||
| const std::vector<symbol::DimExpr> &x_dims = x_shape_or_data.shape(); |
| infer_context->GetShapeOrDataForValue(op->operand_source(1)); | ||
|
|
||
| const std::vector<symbol::DimExpr> &x_dims = x_shape_or_data.shape(); | ||
| const std::vector<symbol::DimExpr> &y_dims = y_shape_or_data.shape(); |
Hongqing-work
previously approved these changes
Aug 23, 2024
Collaborator
|
冲突了 |
33 of 35 tasks
This was referenced Sep 5, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Category
CINN
PR Types
Others
Description
加入bmm, broadcast_tensors:

paddle/fluid/pir/dialect/operator/interface/infer_symbolic_shape/binary_infer_sym.cc
paddle/fluid/pir/dialect/operator/interface/infer_symbolic_shape/binary_infer_sym.h
paddle/phi/ops/yaml/ops.yaml
本地测试pir=True且通过