-
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] Extend ONNX Frontend with Function
Celu-12
(#22002)
### Details: - created implementation for `Celu-12` operator - created tests ### Tickets: - Closes #20543 --------- Co-authored-by: Andrei Kochin <[email protected]> Co-authored-by: Georgy Krivoruchko <[email protected]> Co-authored-by: Katarzyna Mitrus <[email protected]>
- Loading branch information
1 parent
e269340
commit a97abd5
Showing
7 changed files
with
170 additions
and
2 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
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-2024 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#include "op/celu.hpp" | ||
|
||
#include <memory> | ||
|
||
#include "exceptions.hpp" | ||
#include "openvino/op/constant.hpp" | ||
#include "openvino/op/divide.hpp" | ||
#include "openvino/op/elu.hpp" | ||
#include "openvino/op/multiply.hpp" | ||
#include "utils/common.hpp" | ||
|
||
using namespace ov::op; | ||
|
||
namespace ov { | ||
namespace frontend { | ||
namespace onnx { | ||
namespace op { | ||
namespace set_1 { | ||
ov::OutputVector celu(const ov::frontend::onnx::Node& node) { | ||
auto alpha_node = node.get_attribute_as_constant<float>("alpha", 1.0f); | ||
auto x_celu = node.get_ov_inputs().at(0); | ||
|
||
auto divide_node = std::make_shared<v1::Divide>(x_celu, alpha_node); | ||
auto elu_node = std::make_shared<v0::Elu>(divide_node, 1.0); | ||
|
||
return {std::make_shared<v1::Multiply>(alpha_node, elu_node)}; | ||
} | ||
} // namespace set_1 | ||
} // namespace op | ||
} // namespace onnx | ||
} // namespace frontend | ||
} // namespace ov |
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,20 @@ | ||
// Copyright (C) 2018-2024 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#pragma once | ||
|
||
#include "core/node.hpp" | ||
|
||
namespace ov { | ||
namespace frontend { | ||
namespace onnx { | ||
namespace op { | ||
namespace set_1 { | ||
ov::OutputVector celu(const ov::frontend::onnx::Node& node); | ||
|
||
} // namespace set_1 | ||
} // namespace op | ||
} // namespace onnx | ||
} // namespace frontend | ||
} // namespace ov |
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,44 @@ | ||
ir_version: 7 | ||
producer_name: "OpenVINO ONNX Frontend" | ||
graph { | ||
node { | ||
input: "X" | ||
output: "Y" | ||
op_type: "Celu" | ||
attribute { | ||
name: "alpha" | ||
f: 1.0 | ||
type: FLOAT | ||
} | ||
} | ||
name: "test_celu_float" | ||
input { | ||
name: "X" | ||
type { | ||
tensor_type { | ||
elem_type: 1 | ||
shape { | ||
dim { | ||
dim_value: 2 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
output { | ||
name: "Y" | ||
type { | ||
tensor_type { | ||
elem_type: 1 | ||
shape { | ||
dim { | ||
dim_value: 2 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
opset_import { | ||
version: 12 | ||
} |
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 @@ | ||
ir_version: 7 | ||
producer_name: "OpenVINO ONNX Frontend" | ||
graph { | ||
node { | ||
input: "X" | ||
output: "Y" | ||
op_type: "Celu" | ||
attribute { | ||
name: "alpha" | ||
f: 3.0 | ||
type: FLOAT | ||
} | ||
} | ||
name: "test_celu_float_alpha" | ||
input { | ||
name: "X" | ||
type { | ||
tensor_type { | ||
elem_type: 1 | ||
shape { | ||
dim { | ||
dim_value: 4 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
output { | ||
name: "Y" | ||
type { | ||
tensor_type { | ||
elem_type: 1 | ||
shape { | ||
dim { | ||
dim_value: 4 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
opset_import { | ||
version: 12 | ||
} |
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