forked from openvinotoolkit/openvino
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ONNX] Extend ONNX Frontend with Function LessOrEqual (openvinotoolki…
…t#21102) * Implement less_or_equal in set_1 and set_16 * Create tests for ONNX frontend less_or_equal operator
- Loading branch information
1 parent
a5e33f1
commit d9e04c3
Showing
6 changed files
with
207 additions
and
8 deletions.
There are no files selected for viewing
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,35 @@ | ||
// Copyright (C) 2018-2023 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#include "op/less_or_equal.hpp" | ||
OPENVINO_SUPPRESS_DEPRECATED_START | ||
|
||
#include "default_opset.hpp" | ||
|
||
namespace ngraph { | ||
namespace onnx_import { | ||
namespace op { | ||
namespace set_1 { | ||
OutputVector less_or_equal(const Node& node) { | ||
const auto& input = node.get_ng_inputs(); | ||
const auto a = input.at(0); | ||
const auto b = input.at(1); | ||
NGRAPH_CHECK(a.get_element_type() != ov::element::bf16 && b.get_element_type() != ov::element::bf16, | ||
"The input data bfloat16 isn't supported in opset 12"); | ||
return {std::make_shared<default_opset::LessEqual>(a, b)}; | ||
} | ||
} // namespace set_1 | ||
|
||
namespace set_16 { | ||
OutputVector less_or_equal(const Node& node) { | ||
const auto& input = node.get_ng_inputs(); | ||
const auto a = input.at(0); | ||
const auto b = input.at(1); | ||
return {std::make_shared<default_opset::LessEqual>(a, b)}; | ||
} | ||
} // namespace set_16 | ||
} // namespace op | ||
} // namespace onnx_import | ||
} // namespace ngraph | ||
OPENVINO_SUPPRESS_DEPRECATED_END |
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,30 @@ | ||
// Copyright (C) 2018-2023 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#pragma once | ||
|
||
#include "openvino/core/deprecated.hpp" | ||
OPENVINO_SUPPRESS_DEPRECATED_START | ||
|
||
#include "ngraph/node.hpp" | ||
#include "onnx_import/core/node.hpp" | ||
|
||
namespace ngraph { | ||
namespace onnx_import { | ||
namespace op { | ||
namespace set_1 { | ||
|
||
OutputVector less_or_equal(const Node& node); | ||
|
||
} // namespace set_1 | ||
|
||
namespace set_16 { | ||
|
||
OutputVector less_or_equal(const Node& node); | ||
|
||
} // namespace set_16 | ||
} // namespace op | ||
} // namespace onnx_import | ||
} // namespace ngraph | ||
OPENVINO_SUPPRESS_DEPRECATED_END |
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
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,53 @@ | ||
ir_version: 7 | ||
graph { | ||
node { | ||
input: "a" | ||
input: "b" | ||
output: "output" | ||
op_type: "LessOrEqual" | ||
} | ||
name: "LessEqualGraph" | ||
input { | ||
name: "a" | ||
type { | ||
tensor_type { | ||
elem_type: 1 | ||
shape { | ||
dim { | ||
dim_value: 5 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
input { | ||
name: "b" | ||
type { | ||
tensor_type { | ||
elem_type: 1 | ||
shape { | ||
dim { | ||
dim_value: 5 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
output { | ||
name: "output" | ||
type { | ||
tensor_type { | ||
elem_type: 9 | ||
shape { | ||
dim { | ||
dim_value: 5 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
opset_import { | ||
domain: "" | ||
version: 16 | ||
} |
53 changes: 53 additions & 0 deletions
53
src/frontends/onnx/tests/models/less_or_equal_broadcast.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,53 @@ | ||
ir_version: 7 | ||
graph { | ||
node { | ||
input: "a" | ||
input: "b" | ||
output: "output" | ||
op_type: "LessOrEqual" | ||
} | ||
name: "LessEqualGraph" | ||
input { | ||
name: "a" | ||
type { | ||
tensor_type { | ||
elem_type: 1 | ||
shape { | ||
dim { | ||
dim_value: 5 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
input { | ||
name: "b" | ||
type { | ||
tensor_type { | ||
elem_type: 1 | ||
shape { | ||
dim { | ||
dim_value: 1 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
output { | ||
name: "output" | ||
type { | ||
tensor_type { | ||
elem_type: 9 | ||
shape { | ||
dim { | ||
dim_value: 5 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
opset_import { | ||
domain: "" | ||
version: 16 | ||
} |
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