-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ONNX]: Added Range from com.microsoft domain (#28202)
**Overview:** This pull request fixes #17575 . **Dependencies:** - No dependencies on other pull requests. **CC:** - @p-wysocki , @mlukasze --------- Signed-off-by: 11happy <[email protected]> Co-authored-by: Georgy Krivoruchko <[email protected]>
- Loading branch information
Showing
4 changed files
with
176 additions
and
0 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
src/frontends/onnx/frontend/src/op/com.microsoft/range.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright (C) 2018-2025 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#include "openvino/op/range.hpp" | ||
|
||
#include "core/operator_set.hpp" | ||
#include "exceptions.hpp" | ||
#include "openvino/op/constant.hpp" | ||
#include "utils/common.hpp" | ||
|
||
using namespace ov::op; | ||
|
||
namespace ov { | ||
namespace frontend { | ||
namespace onnx { | ||
namespace com_microsoft { | ||
namespace opset_1 { | ||
ov::OutputVector range(const ov::frontend::onnx::Node& node) { | ||
common::default_op_checks(node, 2); | ||
auto nodes = node.get_ov_inputs(); | ||
|
||
auto start = nodes[0]; | ||
auto limit = nodes[1]; | ||
auto delta = | ||
nodes.size() == 3 ? nodes[2] : ov::op::v0::Constant::create(start.get_element_type(), ov::Shape{}, {1}); | ||
CHECK_VALID_NODE(node, | ||
start.get_element_type() == limit.get_element_type(), | ||
"start and limit must be of same type, got :", | ||
start.get_element_type(), | ||
limit.get_element_type()); | ||
CHECK_VALID_NODE(node, | ||
start.get_element_type() == delta.get_element_type(), | ||
"start and delta must be of same type, got :", | ||
start.get_element_type(), | ||
delta.get_element_type()); | ||
return {std::make_shared<ov::op::v4::Range>(start, limit, delta, start.get_element_type())}; | ||
} | ||
ONNX_OP("Range", OPSET_SINCE(1), com_microsoft::opset_1::range, MICROSOFT_DOMAIN); | ||
} // namespace opset_1 | ||
} // namespace com_microsoft | ||
} // namespace onnx | ||
} // namespace frontend | ||
} // namespace ov |
60 changes: 60 additions & 0 deletions
60
src/frontends/onnx/tests/models/com.microsoft/range_with_delta.prototxt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
ir_version: 6 | ||
producer_name: "OpenVINO ONNX Frontend" | ||
graph { | ||
node { | ||
input: "start" | ||
input: "limit" | ||
input: "delta" | ||
output: "output" | ||
op_type: "Range" | ||
domain: "com.microsoft" | ||
} | ||
name: "test_range_float_type_with_delta" | ||
input { | ||
name: "start" | ||
type { | ||
tensor_type { | ||
elem_type: 1 | ||
shape { | ||
} | ||
} | ||
} | ||
} | ||
input { | ||
name: "limit" | ||
type { | ||
tensor_type { | ||
elem_type: 1 | ||
shape { | ||
} | ||
} | ||
} | ||
} | ||
input { | ||
name: "delta" | ||
type { | ||
tensor_type { | ||
elem_type: 1 | ||
shape { | ||
} | ||
} | ||
} | ||
} | ||
output { | ||
name: "output" | ||
type { | ||
tensor_type { | ||
elem_type: 1 | ||
shape { | ||
dim { | ||
dim_value: 10 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
opset_import { | ||
version: 1 | ||
domain: "com.microsoft" | ||
} |
49 changes: 49 additions & 0 deletions
49
src/frontends/onnx/tests/models/com.microsoft/range_without_delta.prototxt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
ir_version: 6 | ||
producer_name: "OpenVINO ONNX Frontend" | ||
graph { | ||
node { | ||
input: "start" | ||
input: "limit" | ||
output: "output" | ||
op_type: "Range" | ||
domain: "com.microsoft" | ||
} | ||
name: "test_range_float_type_without_delta" | ||
input { | ||
name: "start" | ||
type { | ||
tensor_type { | ||
elem_type: 1 | ||
shape { | ||
} | ||
} | ||
} | ||
} | ||
input { | ||
name: "limit" | ||
type { | ||
tensor_type { | ||
elem_type: 1 | ||
shape { | ||
} | ||
} | ||
} | ||
} | ||
output { | ||
name: "output" | ||
type { | ||
tensor_type { | ||
elem_type: 1 | ||
shape { | ||
dim { | ||
dim_value: 10 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
opset_import { | ||
version: 1 | ||
domain: "com.microsoft" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters