提交 c6844dd9 编写于 作者: M Megvii Engine Team

fix(src/gopt): fix padding channel pass error when apply on nchw44 reduce which axis is negative

GitOrigin-RevId: 08735c0ccc72bb95fe6881d7a486820e5638d340
上级 715f61eb
......@@ -552,7 +552,7 @@ void PaddingChannelPass::add_condition_padding_oprs_replace_func(LayoutTrans) {
if (auto reduce = opr->try_cast_final<opr::Reduce>()) {
auto axis = reduce->param().axis;
if (axis < 0) {
axis += reduce->input(0)->layout().ndim;
axis += reduce->input(0)->shape().ndim;
}
//! don't reduce in channel
if (reduce->input().size() > 1) {
......
......@@ -305,7 +305,7 @@ TEST(TestGoptInference, ChannelPaddingReduce) {
auto reduce0 = opr::Reduce::make(
conv2, {opr::Reduce::Mode::MAX, 1}, {}, OperatorNodeConfig("reduce0"));
auto reduce1 = opr::Reduce::make(
conv2, {opr::Reduce::Mode::MAX, 2}, {}, OperatorNodeConfig("reduce1"));
conv2, {opr::Reduce::Mode::MAX, -1}, {}, OperatorNodeConfig("reduce1"));
auto y_reduce = reduce0 + reduce1;
SymbolVar y_pad;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册