MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle2ONNX / DecreaseAxis

Method DecreaseAxis

paddle2onnx/mapper/tensor/slice.cc:64–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62}
63
64std::vector<int64_t> SliceMapper::DecreaseAxis() {
65 std::vector<int64_t> decrease_axis;
66 bool has_attr = HasAttr("decrease_axis");
67 if (has_attr) {
68 GetAttr("decrease_axis", &decrease_axis);
69
70 // In PIR mode, if decrease_axis is not empty, we should use it directly
71 // The shape comparison logic may fail in PIR mode due to input name
72 // differences
73 if (in_pir_mode && !decrease_axis.empty()) {
74 return decrease_axis;
75 }
76
77 auto input_info = GetInput("Input");
78 auto output_info = GetOutput("Out");
79 if (output_info[0].shape.size() == 1 && output_info[0].shape[0] == 0) {
80 return decrease_axis;
81 }
82 if (input_info[0].shape.size() > output_info[0].shape.size()) {
83 return decrease_axis;
84 }
85 return {};
86 }
87 return decrease_axis;
88}
89
90void SliceMapper::Opset7() {
91 auto input_info = GetInput("Input");

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected