-
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
【BUAA】【Infer Symbolic Shape No.90 92 2.8】Add CINN #66892
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
@@ -124,7 +124,7 @@ def setUp(self): | |||
self.convert_bf16() | |||
|
|||
def test_check_output(self): | |||
self.check_output(check_pir=True) |
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.
不要改pir的flag
infer_context->GetShapeOrDataForValue(op->operand_source(0)).shape(); | ||
std::vector<symbol::DimExpr> out_shape; | ||
symbol::DimExpr out_unknown = | ||
infer_context->GetNextSymName(); // unknown until runtime |
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.
秉持最少的引入新符号的原则
op->attribute<pir::StrAttribute>("pooltype").AsString(); | ||
if (pool_type == "MEAN") { | ||
std::vector<symbol::DimExpr> summed_shape; | ||
summed_shape.push_back(out_unknown); |
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.
写个注释,这两个维度是相同的
bool SegmentPoolOpInferSymbolicShape( | ||
pir::Operation *op, pir::InferSymbolicShapeContext *infer_context) { | ||
const auto &input_shape = | ||
infer_context->GetShapeOrDataForValue(op->operand_source(0)).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.
判断一下data区有没有数据,有数据的话需要通过计算得到,不能再上新符号
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.
Thx,已修改~
randperm, segment_pool, set_value有对应optest单测。 |
op->attribute<pir::StrAttribute>("pooltype").AsString(); | ||
|
||
int ndims_ids = ids_shape.size(); | ||
int last_dim = static_cast<int>(ids_shape[ndims_ids - 1].Get<std::int64_t>()); |
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.
这里应该是 ids_shape.size() - 1 吧
if (ids_shape_or_data.data().has_value()) { | ||
const auto &ids_data = ids_shape_or_data.data(); | ||
int out_known = | ||
static_cast<int>(ids_data.value()[last_dim - 1].Get<std::int64_t>()); |
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.
这个维度变换感觉写的有问题,应该是 out_shape.push_back(ids_data.value()[ids_shape.size() -1] + DimExpr{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.
这里可以不再cast成int类型了
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.
LGTM
PR Category
CINN
PR Types
Others
Description
添加 randperm, segment_pool, set_value 算子符号推导接口实现。