Skip to content
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

[NNAdapter] Add fill_range fuse pass、eliminate range op、move scale and expand_v2 op #7200

Merged
merged 23 commits into from
Oct 26, 2021

Conversation

shentanyue
Copy link
Collaborator

No description provided.

zhupengyang
zhupengyang previously approved these changes Oct 18, 2021
Copy link
Collaborator

@zhupengyang zhupengyang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

shape_data = reinterpret_cast<int32_t*>(shape_operand->buffer); \
} else { \
shape_count = shape_operand->type.dimensions.count; \
shape_data = shape_operand->type.dimensions.data; \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为什么要等于shape_operand的维度data?
这种情况可能是来自于一个temporary shape operand , 可以参考 fill 的实现

output_type.dimensions = *reinterpret_cast<NNAdapterOperandDimensionType*>(

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -34,10 +34,13 @@ int ConvertExpand(Converter* converter, hal::Operation* operation) {
if (!input_operator) {
input_operator = converter->ConvertOperand(input_operand);
}
auto shape_operator = converter->ConvertOperand(shape_operand);
auto expand_op = converter->AddOperator<ge::op::Expand>(output_operand);
auto expand_op = converter->AddOperator<ge::op::ExpandD>(output_operand);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为什么不用之前的ge::op::Expand支持shape作为输入,而是用只支持shape属性的ExpandD?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

因为在跑ppyolo模型时,expand算子出现了bug。后来参照训练那边的实现,同时改了两处地方修复了。
1、是expand支持为-1的情况
2、是改成ge::op::ExpandD

uint32_t shape_count; \
int32_t* shape_data; \
auto& shape_type = shape_operand->type; \
if (IsConstantOperand(shape_operand)) { \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不建议把这些判断放在.h里面,将其放在.cc的infershape里面吧,而且else部分的代码有问题,shape_operand->type.dimensions.data 指的是 shape_operand 自己的维度信息

Copy link
Collaborator

@hong19860320 hong19860320 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

先合入,再修一下expand的问题

@hong19860320 hong19860320 merged commit 2ac3cff into PaddlePaddle:develop Oct 26, 2021
@shentanyue
Copy link
Collaborator Author

先合入,再修一下expand的问题

修复PR:#7480

@shentanyue shentanyue deleted the fix_fill_op branch October 27, 2021 10:41
csy0225 pushed a commit to csy0225/Paddle-Lite that referenced this pull request Oct 29, 2021
zhupengyang pushed a commit that referenced this pull request Nov 1, 2021
* [NNAdapter] Move stack op to converter (#7332)

* [NNAdapter] Migrate clip, batch_norm, reduce_mean, transpose and pow op bridges to the new converter framework (#7297)

* [NNAdapter] Add fill_range fuse pass、eliminate range op、move scale and expand_v2 op (#7200)

* [NNAdapter] Migrate cast, norm, pad, dropout converter test=develop,test=huawei_ascend_npu (#7455)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants