diff --git a/src/07onnx/src/operators/reduce.cc b/src/07onnx/src/operators/reduce.cc index a8ae15b5..329d059a 100644 --- a/src/07onnx/src/operators/reduce.cc +++ b/src/07onnx/src/operators/reduce.cc @@ -20,13 +20,23 @@ namespace refactor::onnx { auto noopWithEmptyAxes = false; decltype(Op::axes) axes = std::nullopt; - if (opsetVer >= 18) { - noopWithEmptyAxes = attributes.getOrInsert( "noop_with_empty_axes", {0}).int_() != 0; + + // 针对ReduceSum做特判 + if (opType == "onnx::ReduceSum") { + if (opsetVer >= 13) { + noopWithEmptyAxes = attributes.getOrInsert("noop_with_empty_axes", {0}).int_() != 0; + } else { + axes.emplace(attributes.getOrInsert("axes", {{}}).ints()); + } } else { - axes.emplace(attributes.getOrInsert( "axes", {{}}).ints()); + if (opsetVer >= 18) { + noopWithEmptyAxes = attributes.getOrInsert("noop_with_empty_axes", {0}).int_() != 0; + } else { + axes.emplace(attributes.getOrInsert("axes", {{}}).ints()); + } } - auto keepDims = attributes.getOrInsert( "keepdims", {1}).int_(); + auto keepDims = attributes.getOrInsert("keepdims", {1}).int_(); Ty ty; if (opType == "onnx::ReduceMean") { ty = Ty::Mean;