Commit cd21bddc authored by Tomasz Socha's avatar Tomasz Socha Committed by Robert Kimball

[ONNX] Remove unnecesary Mean in opset 8 (#4053)

* [ONNX] Remove unnecesary Mean in opset 8

* Use opset1 instead of v1

* Fix merge artifact

* Use opset1 Divide instead of opset0
Co-authored-by: 's avatarRobert Kimball <robert.kimball@intel.com>
parent 9bfbd3c6
......@@ -16,10 +16,6 @@
#include "mean.hpp"
#include "default_opset.hpp"
#include "ngraph/op/add.hpp"
#include "ngraph/op/constant.hpp"
#include "ngraph/op/divide.hpp"
#include "ngraph/opsets/opset0.hpp"
#include "utils/variadic.hpp"
namespace ngraph
......@@ -29,25 +25,6 @@ namespace ngraph
namespace op
{
namespace set_1
{
NodeVector mean(const Node& node)
{
auto sum = variadic::make_ng_variadic_op<ngraph::opset0::Add>(node).front();
auto shape = sum->get_shape();
// Create a Constant representing the number of inputs with the same shape as
// sum
auto count = default_opset::Constant::create(
sum->get_element_type(),
shape,
std::vector<int>(shape_size(shape), node.get_ng_inputs().size()));
return {sum / count};
}
} // namespace set_1
namespace set_8
{
NodeVector mean(const Node& node)
{
......@@ -61,10 +38,10 @@ namespace ngraph
shape,
std::vector<int>(shape_size(shape), node.get_ng_inputs().size()));
return {sum / count};
return {std::make_shared<default_opset::Divide>(sum, count)};
}
} // namespace set_8
} // namespace set_1
} // namespace op
......
......@@ -31,12 +31,6 @@ namespace ngraph
} // namespace set_1
namespace set_8
{
NodeVector mean(const Node& node);
} // namespace set_1
} // namespace op
} // namespace onnx_import
......
......@@ -301,7 +301,6 @@ namespace ngraph
REGISTER_OPERATOR("Max", 1, max);
REGISTER_OPERATOR("Max", 8, max);
REGISTER_OPERATOR("Mean", 1, mean);
REGISTER_OPERATOR("Mean", 8, mean);
REGISTER_OPERATOR("MeanVarianceNormalization", 1, mean_variance_normalization);
REGISTER_OPERATOR("MeanVarianceNormalization", 9, mean_variance_normalization);
REGISTER_OPERATOR("Min", 1, min);
......
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