-
Notifications
You must be signed in to change notification settings - Fork 1.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
[NNAdapter] Add fill_range fuse pass、eliminate range op、move scale and expand_v2 op #7200
Conversation
…into fix_fill_op
…into fix_fill_op
lite/backends/nnadapter/nnadapter/driver/huawei_ascend_npu/converter/all.h
Outdated
Show resolved
Hide resolved
b511b70
to
ebaac47
Compare
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
17df392
to
61bde22
Compare
shape_data = reinterpret_cast<int32_t*>(shape_operand->buffer); \ | ||
} else { \ | ||
shape_count = shape_operand->type.dimensions.count; \ | ||
shape_data = shape_operand->type.dimensions.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.
为什么要等于shape_operand的维度data?
这种情况可能是来自于一个temporary shape operand , 可以参考 fill 的实现
output_type.dimensions = *reinterpret_cast<NNAdapterOperandDimensionType*>( |
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.
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); |
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.
为什么不用之前的ge::op::Expand支持shape作为输入,而是用只支持shape属性的ExpandD?
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.
因为在跑ppyolo模型时,expand算子出现了bug。后来参照训练那边的实现,同时改了两处地方修复了。
1、是expand支持为-1的情况
2、是改成ge::op::ExpandD
9307d4c
to
30ad4ca
Compare
…into fix_fill_op test=huawei_ascend_npu
…into fix_fill_op test=huawei_ascend_npu
ebc386e
to
e55d24f
Compare
uint32_t shape_count; \ | ||
int32_t* shape_data; \ | ||
auto& shape_type = shape_operand->type; \ | ||
if (IsConstantOperand(shape_operand)) { \ |
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.
不建议把这些判断放在.h里面,将其放在.cc的infershape里面吧,而且else部分的代码有问题,shape_operand->type.dimensions.data 指的是 shape_operand 自己的维度信息
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.
先合入,再修一下expand的问题
修复PR:#7480 |
* [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)
No description provided.