Skip to content
This repository was archived by the owner on Jan 3, 2023. It is now read-only.

Commit 8fdefa5

Browse files
tsochadiyessi
authored andcommitted
[ONNX] Pow operator (#1557)
1 parent 8bab36f commit 8fdefa5

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

src/ngraph/frontend/onnx_import/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ add_library(onnx_import STATIC
5555
op/mean.hpp
5656
op/min.hpp
5757
op/mul.hpp
58+
op/pow.hpp
5859
op/relu.hpp
5960
op/reshape.cpp
6061
op/reshape.hpp
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
//*****************************************************************************
2+
// Copyright 2017-2018 Intel Corporation
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
//
8+
// http://www.apache.org/licenses/LICENSE-2.0
9+
//
10+
// Unless required by applicable law or agreed to in writing, software
11+
// distributed under the License is distributed on an "AS IS" BASIS,
12+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
15+
//*****************************************************************************
16+
17+
#pragma once
18+
19+
#include "ngraph/node_vector.hpp"
20+
#include "ngraph/op/power.hpp"
21+
22+
#include "core/node.hpp"
23+
#include "utils/broadcasting.hpp"
24+
25+
namespace ngraph
26+
{
27+
namespace onnx_import
28+
{
29+
namespace op
30+
{
31+
inline NodeVector pow(const Node& node)
32+
{
33+
NodeVector ng_inputs{
34+
numpy_style_broadcast_for_binary_operation(node.get_ng_inputs())};
35+
return {std::make_shared<ngraph::op::Power>(ng_inputs.at(0), ng_inputs.at(1))};
36+
}
37+
38+
} // namespace op
39+
40+
} // namespace onnx_import
41+
42+
} // namespace ngraph

src/ngraph/frontend/onnx_import/ops_bridge.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "op/mean.hpp"
3434
#include "op/min.hpp"
3535
#include "op/mul.hpp"
36+
#include "op/pow.hpp"
3637
#include "op/relu.hpp"
3738
#include "op/reshape.hpp"
3839
#include "op/softmax.hpp"
@@ -101,6 +102,7 @@ namespace ngraph
101102
m_map.emplace("Mean", std::bind(op::mean, std::placeholders::_1));
102103
m_map.emplace("Min", std::bind(op::min, std::placeholders::_1));
103104
m_map.emplace("Mul", std::bind(op::mul, std::placeholders::_1));
105+
m_map.emplace("Pow", std::bind(op::pow, std::placeholders::_1));
104106
m_map.emplace("Relu", std::bind(op::relu, std::placeholders::_1));
105107
m_map.emplace("Reshape", std::bind(op::reshape, std::placeholders::_1));
106108
m_map.emplace("Softmax", std::bind(op::softmax, std::placeholders::_1));

0 commit comments

Comments
 (0)