Commit 557ad43b authored by tsocha's avatar tsocha Committed by Artur Wojcik

[ONNX] LRN op (#1645)

* [ONNX] LRN op

* Review fix pt. 1
parent ec90481e
......@@ -67,6 +67,8 @@ add_library(onnx_import STATIC
op/less.hpp
op/log.hpp
op/log_softmax.hpp
op/lrn.cpp
op/lrn.hpp
op/matmul.hpp
op/max_pool.cpp
op/max_pool.hpp
......
//*****************************************************************************
// Copyright 2017-2018 Intel Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//*****************************************************************************
#include <memory>
#include "ngraph/op/lrn.hpp"
#include "core/node.hpp"
#include "lrn.hpp"
namespace ngraph
{
namespace onnx_import
{
namespace op
{
NodeVector lrn(const Node& node)
{
auto data = node.get_ng_inputs().at(0);
double alpha = node.get_attribute_value<double>("alpha", 1e-4);
double beta = node.get_attribute_value<double>("beta", 0.75);
double bias = node.get_attribute_value<double>("bias", 1);
size_t size = node.get_attribute_value<size_t>("size");
return {std::make_shared<ngraph::op::LRN>(data, alpha, beta, bias, size)};
}
} // namespace op
} // namespace onnx_import
} // namespace ngraph
//*****************************************************************************
// Copyright 2017-2018 Intel Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//*****************************************************************************
#pragma once
#include "ngraph/node_vector.hpp"
#include "core/node.hpp"
namespace ngraph
{
namespace onnx_import
{
namespace op
{
NodeVector lrn(const Node& node);
} // namespace op
} // namespace onnx_import
} // namespace ngraph
......@@ -43,6 +43,7 @@
#include "op/less.hpp"
#include "op/log.hpp"
#include "op/log_softmax.hpp"
#include "op/lrn.hpp"
#include "op/matmul.hpp"
#include "op/max.hpp"
#include "op/max_pool.hpp"
......@@ -147,6 +148,7 @@ namespace ngraph
m_map.emplace("Less", std::bind(op::less, std::placeholders::_1));
m_map.emplace("Log", std::bind(op::log, std::placeholders::_1));
m_map.emplace("LogSoftmax", std::bind(op::log_softmax, std::placeholders::_1));
m_map.emplace("LRN", std::bind(op::lrn, std::placeholders::_1));
m_map.emplace("MatMul", std::bind(op::matmul, std::placeholders::_1));
m_map.emplace("MaxPool", std::bind(op::max_pool, std::placeholders::_1));
m_map.emplace("Max", std::bind(op::max, std::placeholders::_1));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment