Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/frontends/onnx/docs/supported_ops.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ OpenVINO provides support for operations of Default Opset (empty in table below)
| |Softplus |1 |22, 1 | |
| |Softsign |1 |22, 1 | |
| |SpaceToDepth |1 |13, 1 | |
| |Split |13, 1 |18, 13, 11, 2, 1 | |
| |Split |18, 13, 1 |18, 13, 11, 2, 1 | |
| |SplitToSequence | |11 | |
| |Sqrt |1 |13, 6, 1 | |
| |Squeeze |13, 1 |21, 13, 11, 1 | |
Expand Down
16 changes: 15 additions & 1 deletion src/frontends/onnx/frontend/src/op/split.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,22 @@ ov::OutputVector split(const ov::frontend::onnx::Node& node) {
}
}

ONNX_OP("Split", OPSET_SINCE(13), ai_onnx::opset_13::split);
ONNX_OP("Split", OPSET_RANGE(13, 18), ai_onnx::opset_13::split);
} // namespace opset_13

namespace opset_18 {
ov::OutputVector split(const ov::frontend::onnx::Node& node) {
if (node.has_attribute("num_outputs")) {
const auto inputs = node.get_ov_inputs();
const auto outputs_number = node.get_attribute_value<int64_t>("num_outputs", 0);
const auto axis = node.get_attribute_value<int64_t>("axis", 0);
return ov::op::util::make_split(inputs.at(0), outputs_number, axis);
}
return ai_onnx::opset_13::split(node);
}

ONNX_OP("Split", OPSET_SINCE(18), ai_onnx::opset_18::split);
} // namespace opset_18
} // namespace ai_onnx
} // namespace onnx
} // namespace frontend
Expand Down
3 changes: 3 additions & 0 deletions src/frontends/onnx/frontend/src/utils/split.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ OutputVector make_split(const Output<ov::Node>& value, int64_t num_splits, int64
if (axis_len % num_splits) {
auto avg_axis = (axis_len + num_splits - 1) / num_splits; // Round up division
auto last_output_value = axis_len % avg_axis;
if (last_output_value == 0) {
FRONT_END_THROW("The split number is invalid");
}
std::vector<int64_t> split_lengths(num_splits, avg_axis);
split_lengths.back() = last_output_value;
return make_split(value, split_lengths, axis);
Expand Down
2 changes: 2 additions & 0 deletions src/frontends/onnx/tests/tests_python/test_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,8 @@ def expect_fail(test_case_path, xfail): # type: (str) -> None
),
(
xfail_issue_125485,
"OnnxBackendNodeModelTest.test_affine_grid_2d_align_corners_expanded_cpu",
"OnnxBackendNodeModelTest.test_affine_grid_2d_expanded_cpu",
"OnnxBackendNodeModelTest.test_affine_grid_3d_align_corners_expanded_cpu",
"OnnxBackendNodeModelTest.test_affine_grid_3d_expanded_cpu",
),
Expand Down
Loading