Commit a0ca764f authored by Tomasz Dołbniak's avatar Tomasz Dołbniak Committed by Scott Cyphers

[ONNX] Use v1::Minimum and v1::Maximum in Clip and LeakyRelu (#4068)

* Use v1::Minimum and v1::Maximum in ONNX Clip implementation

* Use v1::Maximum in ONNX LeakyRelu
Co-authored-by: 's avatarScott Cyphers <diyessi@users.noreply.github.com>
parent 8ee4c69d
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include "clip.hpp" #include "clip.hpp"
#include "default_opset.hpp" #include "default_opset.hpp"
#include "ngraph/builder/make_constant.hpp" #include "ngraph/builder/make_constant.hpp"
#include "ngraph/opsets/opset0.hpp"
namespace ngraph namespace ngraph
{ {
...@@ -49,8 +48,8 @@ namespace ngraph ...@@ -49,8 +48,8 @@ namespace ngraph
{ {
NodeVector clip(const Node& node) NodeVector clip(const Node& node)
{ {
NodeVector inputs{node.get_ng_inputs()}; const NodeVector inputs{node.get_ng_inputs()};
std::shared_ptr<ngraph::Node> data = inputs.at(0); const std::shared_ptr<ngraph::Node> data = inputs.at(0);
const element::Type data_type = data->get_element_type(); const element::Type data_type = data->get_element_type();
const Shape data_shape = data->get_shape(); const Shape data_shape = data->get_shape();
std::shared_ptr<ngraph::Node> min; std::shared_ptr<ngraph::Node> min;
...@@ -80,15 +79,10 @@ namespace ngraph ...@@ -80,15 +79,10 @@ namespace ngraph
data_type, data_shape, std::numeric_limits<double>::max()); data_type, data_shape, std::numeric_limits<double>::max());
} }
auto max_of_min_and_data = std::make_shared<ngraph::opset0::Maximum>( const auto max_of_min_and_data =
min, std::make_shared<default_opset::Maximum>(min, data);
data,
ngraph::op::AutoBroadcastSpec(ngraph::op::AutoBroadcastType::NUMPY));
return {std::make_shared<ngraph::opset0::Minimum>( return {std::make_shared<default_opset::Minimum>(max, max_of_min_and_data)};
max,
max_of_min_and_data,
ngraph::op::AutoBroadcastSpec(ngraph::op::AutoBroadcastType::NUMPY))};
} }
} // namespace set_11 } // namespace set_11
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include "leaky_relu.hpp" #include "leaky_relu.hpp"
#include "ngraph/op/constant.hpp" #include "ngraph/op/constant.hpp"
#include "ngraph/op/multiply.hpp" #include "ngraph/op/multiply.hpp"
#include "ngraph/opsets/opset0.hpp"
namespace ngraph namespace ngraph
{ {
...@@ -43,7 +42,7 @@ namespace ngraph ...@@ -43,7 +42,7 @@ namespace ngraph
std::make_shared<default_opset::Constant>(data->get_element_type(), std::make_shared<default_opset::Constant>(data->get_element_type(),
data->get_shape(), data->get_shape(),
std::vector<double>{alpha}); std::vector<double>{alpha});
return {std::make_shared<ngraph::opset0::Maximum>(data * alpha_node, data)}; return {std::make_shared<default_opset::Maximum>(data * alpha_node, data)};
} }
} // namespace set_1 } // namespace set_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